expect($index->getSubjectNamespaces())->to_equal(array($ex)); }); describe("getVocabularyNamespaces", function () { it("should return namespaces used in properties", function () { $index = getIndex(); $ex = 'http://example.com/terms/'; $index->addPredicateObject($ex . 'a', 'foo', 1); $index->addPredicateObject($ex . 'b', 'foo', 1); $index->addPredicateObject($ex . 'c', 'foo', 1); $index->addPredicateObject($ex . 'v2/a', 'foo', 1); expect($index->getVocabularyNamespaces())->to_equal(array($ex, $ex . 'v2/')); }); }); it("should return results from a triple pattern query", function () { $index = getRafflesStore(true)->Index; $triplepattern = getTriplePatternArray(); $actual = $index->query($triplepattern); expect($actual)->to_equal(array(37)); //Alexander Pope }); describe("Facets", function () { it("should filtered by a set of ids to the intersection", function () { $store = getRafflesStore(); $exns = 'http://example.com/'; $data = <<<_TTL_ @base <{$exns}> . <A> a <Book> ; <date> "1500" . <C> a <Book> ; <date> "1500" . <B> a <Person> ; <born> "1450" . _TTL_; $store->loadData($data);
<?php require_once 'vendor/autoload.php'; //require_once 'lib/ldpath.php'; require_once 'specs/spechelpers.php'; describe("LDPath", function () { it("should turn an LDPath string into an associative array that can be processed into index queries", function () { $path = new \Raffles\LDPath(); $actual = $path->parse("foaf:made/dct:date=1728"); $expected = getTriplePatternArray(); expect($actual)->to_equal($expected); }); it("should leave http uris as they are", function () { $path = new \Raffles\LDPath(); $actual = $path->parse("rdf:type=http://example.org/Thing"); $expected = array(array('s' => array('type' => 'variable', 'value' => 'a'), 'p' => array('type' => 'uri', 'value' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), 'o' => array('type' => 'uri', 'value' => 'http://example.org/Thing'))); expect($actual)->to_equal($expected); }); it("should recognise literals with escaped colons as literals, not curies", function () { $path = new \Raffles\LDPath(); $actual = $path->parse("rdfs:label=Wanted\\:bugs"); $expected = array(array('s' => array('type' => 'variable', 'value' => 'a'), 'p' => array('type' => 'uri', 'value' => 'http://www.w3.org/2000/01/rdf-schema#label'), 'o' => array('type' => 'literal', 'value' => 'Wanted:bugs'))); expect($actual)->to_equal($expected); }); it("should parse CURIEs in object position into URIs", function () { $path = new \Raffles\LDPath(); $actual = $path->parse("rdf:type=foaf:Person"); $expected = array(array('s' => array('type' => 'variable', 'value' => 'a'), 'p' => array('type' => 'uri', 'value' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), 'o' => array('type' => 'uri', 'value' => 'http://xmlns.com/foaf/0.1/Person'))); expect($actual)->to_equal($expected); }); it("should parse CURIEs into URIs", function () {