コード例 #1
0
 function setup()
 {
     parent::setup();
     // Fill database
     $OK = $this->_triples->addTriple('Bob', 'knows', 'Alice', 'wiki');
     $this->assertTrue($OK);
     $OK = $this->_triples->addTriple('Alice', 'knows', 'Carol', 'wiki');
     $this->assertTrue($OK);
     $OK = $this->_triples->addTriple('Alice', 'dislikes', 'Carol', 'wiki');
     $this->assertTrue($OK);
     $this->expected1 = array('subject' => 'Bob', 'predicate' => 'knows', 'object' => 'Alice', 'graph' => 'wiki');
     $this->expected2 = array('subject' => 'Alice', 'predicate' => 'knows', 'object' => 'Carol', 'graph' => 'wiki');
     $this->expected3 = array('subject' => 'Alice', 'predicate' => 'dislikes', 'object' => 'Carol', 'graph' => 'wiki');
     $data = $this->_triples->fetchTriples();
     $this->assertEqual($data, array($this->expected1, $this->expected2, $this->expected3));
 }
コード例 #2
0
 function setup()
 {
     parent::setup();
     // Load types
     $types = new helper_plugin_strata_util();
     $string = $types->loadType('string');
     $ref = $types->loadType('ref');
     $image = $types->loadType('image');
     // Create objects
     $bob = $ref->normalize('Bob', 'person');
     $alice = $ref->normalize('Alice', 'person');
     $carol = $ref->normalize('Carol', 'person');
     $img_bob = $ref->normalize('Bob.png', 50);
     $img_alice = $ref->normalize('Alice.svg', 50);
     $img_carol = $ref->normalize('Carol.jpg', 50);
     // Fill database
     $this->_triples->addTriple($bob, 'class', 'person', 'wiki');
     $this->_triples->addTriple($alice, 'class', 'person', 'wiki');
     $this->_triples->addTriple($carol, 'class', 'person', 'wiki');
     $this->_triples->addTriple($bob, 'name', 'Bob', 'wiki');
     $this->_triples->addTriple($alice, 'name', 'Alice', 'wiki');
     $this->_triples->addTriple($carol, 'name', 'Carol', 'wiki');
     $this->_triples->addTriple($bob, 'identifier', 'Β', 'wiki');
     $this->_triples->addTriple($alice, 'identifier', 'α', 'wiki');
     $this->_triples->addTriple($carol, 'identifier', 'γ', 'wiki');
     $this->_triples->addTriple($bob, 'knows', $alice, 'wiki');
     $this->_triples->addTriple($alice, 'knows', $carol, 'wiki');
     $this->_triples->addTriple($carol, 'knows', $bob, 'wiki');
     $this->_triples->addTriple($carol, 'knows', $alice, 'wiki');
     $this->_triples->addTriple($bob, 'likes', $alice, 'wiki');
     $this->_triples->addTriple($bob, 'looks like', $img_bob, 'wiki');
     $this->_triples->addTriple($alice, 'looks like', $img_alice, 'wiki');
     $this->_triples->addTriple($carol, 'looks like', $img_carol, 'wiki');
     $this->_triples->addTriple($bob, 'is rated', 8, 'wiki');
     $this->_triples->addTriple($alice, 'is rated', 10, 'wiki');
     $this->_triples->addTriple($carol, 'is rated', 1, 'wiki');
     $this->_triples->addTriple($bob, 'has length', '5 ft 10 in', 'wiki');
     $this->_triples->addTriple($alice, 'has length', '5 ft 5 in', 'wiki');
     $this->_triples->addTriple($carol, 'has length', '4 ft 11 in', 'wiki');
     $this->_triples->addTriple($bob, 'tax rate', '25%', 'wiki');
     $this->_triples->addTriple($alice, 'tax rate', '10%', 'wiki');
     $this->_triples->addTriple($carol, 'tax rate', '2%', 'wiki');
 }