public function testCeres()
 {
     $output = executeExample('villages.php', array('id' => '934787'));
     $this->assertContains('<h2>Ceres, Fife</h2>', $output);
     $this->assertContains('<p>Ceres is a village in Fife, Scotland', $output);
     $this->assertContains("src='http://maps.google.com/maps?f=q&amp;ll=56.29205,-2.971445&amp;output=embed'>", $output);
 }
 public function testJoeBloggs()
 {
     $output = executeExample('foafmaker.php', array('uri' => 'http://www.example.com/joe#me', 'title' => 'Mr', 'given_name' => 'Joe', 'family_name' => 'Bloggs', 'email' => '*****@*****.**', 'nickname' => 'Joe', 'homepage' => 'http://www.example.com/joe/', 'person_1' => 'http://www.example.com/fred#me', 'person_2' => 'http://www.example.com/alice#me', 'person_3' => '', 'person_4' => '', 'format' => 'turtle'));
     $this->assertContains('<title>EasyRdf FOAF Maker Example</title>', $output);
     $this->assertContains('<h1>EasyRdf FOAF Maker Example</h1>', $output);
     $this->assertContains("@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .\n\n" . "&lt;http://www.example.com/joe#me&gt;\n" . "  a foaf:Person ;\n" . "  foaf:name &quot;Mr Joe Bloggs&quot; ;\n" . "  foaf:mbox &lt;mailto:joe@example.com&gt; ;\n" . "  foaf:homepage &lt;http://www.example.com/joe/&gt; ;\n" . "  foaf:title &quot;Mr&quot; ;\n" . "  foaf:givenname &quot;Joe&quot; ;\n" . "  foaf:family_name &quot;Bloggs&quot; ;\n" . "  foaf:nick &quot;Joe&quot; ;\n" . "  foaf:knows &lt;http://www.example.com/fred#me&gt;," . " &lt;http://www.example.com/alice#me&gt; .\n", $output);
 }
Exemplo n.º 3
0
 public function testRdfXml()
 {
     $output = executeExample('httpget.php', array('uri' => 'http://tomheath.com/id/me', 'accept' => 'application/rdf+xml'));
     $this->assertContains('<title>Test EasyRdf_HTTP_Client Get</title>', $output);
     $this->assertContains('<h1>Test EasyRdf_HTTP_Client Get</h1>', $output);
     $this->assertContains('<b>Content-type</b>: application/rdf+xml<br />', $output);
     $this->assertContains('&lt;foaf:Person rdf:about=&quot;http://tomheath.com/id/me&quot;&gt;<br />', $output);
 }
Exemplo n.º 4
0
 public function testCeres()
 {
     $output = executeExample('parse_rss.php', array('uri' => 'http://planetrdf.com/index.rdf'));
     $this->assertContains('<p>Channel: <a href="http://planetrdf.com/">Planet RDF</a></p>', $output);
     $this->assertContains("<p>Description: It's triples all the way down</p>", $output);
     $this->assertContains('<li><a href="http://', $output);
     $this->assertContains('</a></li>', $output);
 }
 public function testDumpText()
 {
     $output = executeExample('dump.php', array('uri' => 'http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.rdf', 'format' => 'text'));
     $this->assertContains('<title>EasyRdf Graph Dumper</title>', $output);
     $this->assertContains('<h1>EasyRdf Graph Dumper</h1>', $output);
     $this->assertContains('Graph: http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.rdf', $output);
     $this->assertContains('http://example/q?abc=1&def=2 (EasyRdf_Resource)', $output);
     $this->assertContains('-> rdf:value -> "xxx"', $output);
 }
 public function test()
 {
     $output = executeExample('index.php');
     $this->assertContains('<title>EasyRdf Examples</title>', $output);
     $this->assertContains('<h1>EasyRdf Examples</h1>', $output);
     $this->assertContains("<h2><a href='basic.php'>basic.php</a></h2>", $output);
     $this->assertContains('<p>Basic "Hello World" type example</p>', $output);
     $this->assertContains('<p>A new EasyRdf_Graph object is created and then the contents', $output);
 }
 public function testW1A1AA()
 {
     $output = executeExample('uk_postcode.php', array('postcode' => 'W1A 1AA'));
     $this->assertContains('<tr><th>Easting:</th><td>528887</td></tr>', $output);
     $this->assertContains('<tr><th>Northing:</th><td>181593</td></tr>', $output);
     $this->assertContains('<tr><th>Longitude:</th><td>-0.143785</td></tr>', $output);
     $this->assertContains('<tr><th>Latitude:</th><td>51.518562</td></tr>', $output);
     $this->assertContains('<tr><th>Electoral Ward:</th><td>West End</td></tr>', $output);
     $this->assertContains("src='http://maps.google.com/maps?f=q&amp;ll=51.518562,-0.143785&amp;output=embed'", $output);
 }
Exemplo n.º 8
0
 public function testBruce()
 {
     $output = executeExample('artistinfo.php', array('uri' => 'http://www.bbc.co.uk/music/artists/70248960-cb53-4ea4-943a-edb18f7d336f.rdf'));
     $this->assertContains('<title>EasyRdf Artist Info Example</title>', $output);
     $this->assertContains('<h1>EasyRdf Artist Info Example</h1>', $output);
     $this->assertContains('<dt>Artist Name:</dt><dd>Bruce Springsteen</dd>', $output);
     $this->assertContains("<dt>Type:</dt><dd>mo:MusicArtist, mo:SoloMusicArtist</dd>", $output);
     $this->assertContains('<dt>Homepage:</dt><dd><a href="http://www.brucespringsteen.net/">' . 'http://www.brucespringsteen.net/</a></dd>', $output);
     $this->assertContains('<dt>Wikipedia page:</dt><dd><a href="http://en.wikipedia.org/wiki/Bruce_Springsteen">' . 'http://en.wikipedia.org/wiki/Bruce_Springsteen</a></dd>', $output);
     $this->assertContains("<dt>Age:</dt>  <dd>" . (date('Y') - 1949) . "</dd>", $output);
 }
Exemplo n.º 9
0
 public function test()
 {
     $output = executeExample('graph_direct.php');
     $this->assertContains('<title>Example of using EasyRdf_Graph directly</title>', $output);
     $this->assertContains('<b>Name:</b> Joe Bloggs <br />', $output);
     $this->assertContains('<b>Names:</b> Joe Bloggs Joseph Bloggs <br />', $output);
     $this->assertContains('<b>Label:</b> Nick <br />', $output);
     $this->assertContains('<b>Properties:</b> rdf:type, foaf:name, rdfs:label <br />', $output);
     $this->assertContains('<b>PropertyUris:</b> http://www.w3.org/1999/02/22-rdf-syntax-ns#type, ' . 'http://xmlns.com/foaf/0.1/name, http://www.w3.org/2000/01/rdf-schema#label <br />', $output);
     $this->assertContains('<b>People:</b> http://example.com/joe, http://njh.me/ <br />', $output);
     $this->assertContains('<b>Unknown:</b>  <br />', $output);
 }
Exemplo n.º 10
0
 public function testNjh()
 {
     $output = executeExample('foafinfo.php', array('uri' => 'http://njh.me/foaf.rdf'));
     $this->assertContains('<title>EasyRdf FOAF Info Example</title>', $output);
     $this->assertContains('<h1>EasyRdf FOAF Info Example</h1>', $output);
     $this->assertContains("<dt>Name:</dt><dd>Nicholas J Humfrey</dd>", $output);
     $this->assertContains("<dt>Homepage:</dt><dd><a href=\"http://www.aelius.com/njh/\">http://www.aelius.com/njh/</a></dd>", $output);
     $this->assertContains("<h2>Known Persons</h2>", $output);
     $this->assertContains(">Patrick Sinclair</a></li>", $output);
     $this->assertContains(">Yves Raimond</a></li>", $output);
     $this->assertContains("<h2>Interests</h2>", $output);
     $this->assertContains(">RDF</a></li>", $output);
 }
Exemplo n.º 11
0
 public function testCountries()
 {
     $output = executeExample('basic_sparql.php');
     $this->assertContains('<title>EasyRdf Basic Sparql Example</title>', $output);
     $this->assertContains('<h1>EasyRdf Basic Sparql Example</h1>', $output);
     $this->assertContains('<h2>List of countries</h2>', $output);
     $this->assertContains('<li><a href="http://dbpedia.org/resource/China">China</a></li>', $output);
     $this->assertContains('<li><a href="http://dbpedia.org/resource/India">India</a></li>', $output);
     $this->assertContains('<li><a href="http://dbpedia.org/resource/United_States">United States</a></li>', $output);
     $this->assertContains('<li><a href="http://dbpedia.org/resource/United_Kingdom">United Kingdom</a></li>', $output);
     $this->assertContains('<li><a href="http://dbpedia.org/resource/Zimbabwe">Zimbabwe</a></li>', $output);
     $this->assertRegExp('|Total number of countries: (\\d+)|', $output);
 }
 public function testPageRendersCorrectly()
 {
     $output = executeExample('basic.php');
     $this->assertContains('<title>Basic FOAF example</title>', $output);
     $this->assertContains('My name is: Nicholas J Humfrey', $output);
 }
Exemplo n.º 13
0
 public function testPhp()
 {
     $output = executeExample('serialise.php', array('format' => 'php'));
     $this->assertContains('<title>EasyRdf Serialiser Example</title>', $output);
     $this->assertContains("'value' =&gt; 'http://xmlns.com/foaf/0.1/Person',", $output);
 }
 public function testDbpediaCountriesText()
 {
     $output = executeExample('sparql_queryform.php', array('endpoint' => 'http://dbpedia.org/sparql', 'query' => 'PREFIX dbo: <http://dbpedia.org/ontology/> ' . 'SELECT * WHERE {' . '  ?country rdf:type dbo:Country . ' . '  ?country rdfs:label ?label .' . '  ?country dc:subject category:Member_states_of_the_United_Nations .' . '  FILTER ( lang(?label) = "en" ) ' . '} ORDER BY ?label LIMIT 100', 'text' => 1));
     $this->assertContains('| http://dbpedia.org/resource/China', $output);
     $this->assertContains('| &quot;China&quot;@en', $output);
 }
Exemplo n.º 15
0
 public function testConvertTurtleRaw()
 {
     $output = executeExample('converter.php', array('uri' => 'http://www.w3.org/TR/turtle/examples/example1.ttl', 'input_format' => 'guess', 'output_format' => 'ntriples', 'raw' => 1));
     $this->assertSame("<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> " . "\"RDF/XML Syntax Specification (Revised)\" .\n" . "<http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:genid1 .\n" . "_:genid1 <http://example.org/stuff/1.0/fullname> \"Dave Beckett\" .\n" . "_:genid1 <http://example.org/stuff/1.0/homePage> <http://purl.org/net/dajobe/> .\n", $output);
 }