Example #1
0
 /**
  * @return string
  * @throws \Exception
  */
 public function getDatatype()
 {
     $nodeFactory = new NodeFactory();
     $datatypeUri = self::$xsdString;
     $datatype = librdf_node_get_literal_value_datatype_uri($this->redlandNode);
     if ($datatype !== null) {
         $datatypeUri = librdf_uri_to_string($datatype);
     } elseif ($this->getLanguage() !== null) {
         $datatypeUri = self::$rdfLangString;
     }
     return $nodeFactory->createNamedNode($datatypeUri);
 }
Example #2
0
 public function newInstance($subject, $predicate, $object, $graph = null)
 {
     $world = librdf_php_get_world();
     $factory = new NodeFactory();
     try {
         $redlandSubject = $factory->createRedlandNodeFromNode($subject);
         $redlandPredicate = $factory->createRedlandNodeFromNode($predicate);
         $redlandObject = $factory->createRedlandNodeFromNode($object);
         $statement = librdf_new_statement_from_nodes($world, $redlandSubject, $redlandPredicate, $redlandObject);
         return new Statement($statement, $graph);
     } catch (\Exception $e) {
         $this->markTestSkipped('Can\'t execute this test because: ' . $e->getMessage());
     }
 }
Example #3
0
 /**
  * Return a new instance of redland Literal
  */
 public function newInstance($value, Node $datatype = null, $lang = null)
 {
     $factory = new NodeFactory();
     return $factory->createLiteral($value, $datatype, $lang);
 }
Example #4
0
 public function newInstance($uri)
 {
     $nodeFactory = new NodeFactory();
     return $nodeFactory->createNamedNode($uri);
 }