/** * Returns given Node instance in SPARQL format, which is in NQuads or as Variable * * @param Node $node Node instance to format. * @param string $var The variablename, which should be used, if the node is not concrete * @return string Either NQuad notation (if node is concrete) or as variable. */ public static function getNodeInSparqlFormat(Node $node, $var = null) { if ($node->isConcrete()) { return $node->toNQuads(); } if ($var == null) { $var = uniqid('tempVar'); } return '?' . $var; }