public function testCorrectness() { $triples = array('http://example.com/s' => array('http://example.com/p' => array(array('type' => 'uri', 'value' => 'http://example.com/o')))); $json = json_encode($triples); $result = $this->_object->parseFromDataString($json); //decode $this->assertEquals($triples, $result); }
public function testParseRecursiveEntity() { $xml = '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE rdf:RDF [ <!ENTITY location "http://www.w3.org/2002/07/owl"> <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#"> <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"> <!ENTITY dc "http://purl.org/dc/elements/1.1/"> <!ENTITY grddl "http://www.w3.org/2003/g/data-view#"> <!ENTITY owl "&location;#" > ]> <rdf:RDF xml:base="&location;" xmlns:conferences="&location;" xmlns:owl="&owl;" xmlns:rdf="&rdf;"> <owl:Class rdf:about="#test" /> </rdf:RDF>'; try { $result = $this->_object->parseFromDataString($xml); $this->assertEquals('http://www.w3.org/2002/07/owl#Class', $result['http://www.w3.org/2002/07/owl#test'][EF_RDF_TYPE][0]['value']); } catch (Erfurt_Syntax_RdfParserException $e) { $this->fail($e->getMessage()); } }