private function getSourceFact( $variableSet, $evaluationResult, $log )
	{
		$sourceQName = null;

		if ( count( $this->qname ) )
		{
			$sourceQName = new QName( $this->qname[0]['originalPrefix'], $this->qname[0]['namespace'], $this->qname[0]['name'] );
			if ( ! $sourceQName ) return null;
		}
		elseif ( count( $this->qnameExpression ) )
		{
			$qname = $this->evaluateXPath( $variableSet, $this->qnameExpression[0], $evaluationResult['vars'] );
			if ( $qname instanceof XPath2Item )
			{
				$qname = $qname->getTypedValue();
			}
			if ( ! $qname ) return null;
			$sourceQName = new QName( $qname->Prefix, $qname->NamespaceUri, $qname->LocalName );
		}
		else
		{
			return null;
		}

		// OK, got the source fact but it might be a variable in which case the value of the variable will be required
		if ( isset( $variableSet->variablesByQName[ $sourceQName->clarkNotation() ] ) )
		{
			if ( ! isset( $evaluationResult['vars'][ $sourceQName->clarkNotation() ] ) )
			{
				$log->formula_validation( "Concept aspect", "Unable to find variable",
					array(
						'variable' => $sourceQName->clarkNotation(),
						'error' => 'xbrlfe:incompleteConceptRule'
					)
				);
			}
			// Get the evaluation value for this variable
			$fact = $evaluationResult['vars'][ $sourceQName->clarkNotation() ];
			if ( $fact instanceof XPath2NodeIterator )
			{
				// Get the first fact
				while (true)
				{
					foreach ( $fact as $node )
					{
						if ( ! $node instanceof DOMXPathNavigator ) continue;
						$fact = $node;
						break 2;
					}

					$fact = null;
					break;
				}
			}

			if ( $fact instanceof XPathNavigator )
			{
				$sourceQName = new QName( $fact->getPrefix(), $fact->getNamespaceURI(), $fact->getLocalName() );
			}
			else
			{
				$log->formula_validation( "Concept aspect", "The variable reference does not point to a result node",
					array(
						'variable' => $sourceQName->clarkNotation(),
						'error' => 'xbrlfe:incompleteConceptRule'
					)
				);
			}
		}
		return $sourceQName;
	}