当前位置: 首页>>代码示例>>PHP>>正文


PHP MemModel::add方法代码示例

本文整理汇总了PHP中MemModel::add方法的典型用法代码示例。如果您正苦于以下问题:PHP MemModel::add方法的具体用法?PHP MemModel::add怎么用?PHP MemModel::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MemModel的用法示例。


在下文中一共展示了MemModel::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateModelFromString

 /**
  * This method takes a json encoded rdf-model and a reference to aa (usually empty) MemModel, parses the json
  * string and adds the statements to the given MemModel.
  *
  * @param string $jsonString The string that contains the rdf model, encoded as a json-string.
  * @param MemModel $model A reference to the model, where to add the statements, usually an empty MemModel.
  */
 public function generateModelFromString($jsonString, $model)
 {
     $jsonModel = array();
     $jsonModel = json_decode($jsonString, true);
     // throws an excpetion if json model was corrupt
     if (!is_array($jsonModel)) {
         throw new Exception('error in json string');
     }
     foreach ($jsonModel as $subject => $remain) {
         foreach ($remain as $predicate => $object) {
             $s = strpos($subject, '_') === 0 ? new BlankNode(substr($subject, 2)) : new Resource($subject);
             $p = new Resource($predicate);
             foreach ($object as $obj) {
                 if ($obj['type'] === 'uri') {
                     $o = new Resource($obj['value']);
                 } else {
                     if ($obj['type'] === 'bnode') {
                         $o = new BlankNode(substr($obj['value'], 2));
                     } else {
                         $dtype = isset($obj['datatype']) ? $obj['datatype'] : '';
                         $lang = isset($obj['lang']) ? $obj['lang'] : '';
                         $oVal = $obj['value'];
                         $o = new Literal($oVal, $lang);
                         $o->setDatatype($dtype);
                     }
                 }
                 $model->add(new Statement($s, $p, $o));
             }
         }
     }
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:38,代码来源:JsonParser.php

示例2: testGenerateModelFromString

 function testGenerateModelFromString()
 {
     $parser = new JsonParser();
     $model = new MemModel('http://example.com/');
     try {
         $parser->generateModelFromString($this->modelString, $model);
     } catch (Exception $e) {
         $this->fail($e->getMessage());
     }
     #echo "<pre>";
     #print_r($model);
     global $short_datatype;
     $model2 = new MemModel('http://example.com/');
     // Ceate new statements and add them to the model
     $statement1 = new Statement(new Resource('http://example.org/about'), new Resource('http://purl.org/dc/elements/1.1/creator'), new Literal('Anna Wilder'));
     $statement2 = new Statement(new Resource('http://example.org/about'), new Resource("http://purl.org/dc/elements/1.1/title"), new Literal('Annas Homepage', 'en'));
     $statement3 = new Statement(new Resource('http://example.org/about'), new Resource('http://xmlns.com/foaf/0.1/maker'), new BlankNode('person'));
     $statement4 = new Statement(new BlankNode('person'), new Resource("http://xmlns.com/foaf/0.1/homepage"), new Resource('http://example.org/about'));
     $statement5 = new Statement(new Resource('http://example.org/about'), new Resource("http://purl.org/dc/elements/1.1/title2"), new Literal('Anns HP', 'en', $short_datatype['STRING']));
     $statement6 = new Statement(new Resource('http://example.org/about'), new Resource("http://purl.org/dc/elements/1.1/title2"), new Literal('Anns HP', 'en', $short_datatype['INTEGER']));
     $statement7 = new Statement(new BlankNode('person'), new Resource("http://example.com/testProp1"), new Literal("\"double quote\nnewline\ttab\rcarriage return\\reverse solidus"));
     $model2->add($statement1);
     $model2->add($statement2);
     $model2->add($statement3);
     $model2->add($statement4);
     $model2->add($statement5);
     $model2->add($statement7);
     $this->assertTrue($model->containsAll($model2));
     $model2->remove($statement5);
     $model2->add($statement6);
     $this->assertFalse($model->containsAll($model2));
     #echo "<pre>";
     #print_r($model2);
     #echo "</pre>";
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:35,代码来源:jsonParser_test.php

示例3: MemModel

 function _generateModel($num, $ind)
 {
     $model = new MemModel();
     $model->index($ind);
     for ($i = 0; $i < $num; $i++) {
         $subs[$i] = new Resource('http://www.example.org/sub' . $i % 3);
         $preds[$i] = new Resource('http://www.example.org/pred' . $i % 5);
         $objs[$i] = new Resource('http://www.example.org/obj' . $i % 9);
         $stat = new Statement($subs[$i], $preds[$i], $objs[$i]);
         $model->add($stat);
     }
     return $model;
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:13,代码来源:ut_it_tests.php

示例4: testlistSubjectsWithPropertyTest

 /**
  * tests listSubjectsWithProperty()
  */
 function testlistSubjectsWithPropertyTest()
 {
     $_SESSION['test'] = 'ResModel listSubjectsWithProperty test';
     $model1 = new MemModel();
     $needle = new Statement(new Resource('http://www.example.org/needle'), new Resource('http://www.example.org/pred'), new Resource('http://www.example.org/ob'));
     $model1->add($needle);
     $resmodel = new ResModel($model1);
     $resresource = $resmodel->createResource('http://www.example.org/testresource');
     $prop = $resmodel->createProperty('http://www.example.org/pred');
     $resresource->addProperty($prop, new ResLiteral('Object'));
     $property = new ResResource('http://www.example.org/pred');
     $res = $resmodel->listSubjectsWithProperty($property);
     $this->assertEqual(1, count($res));
     $model1->close();
 }
开发者ID:richardjennings,项目名称:rap,代码行数:18,代码来源:ResModel_Property_tests.php

示例5: MemModel

 /**
  * Create a MemModel containing only the base triples (without inferred 
  * statements) of the current InfModelB.
  *
  * @return object MemModel
  * @access public
  */
 function &getBaseMemModel()
 {
     $return = new MemModel();
     $return->setBaseURI($this->baseURI);
     foreach ($this->triples as $statement) {
         $return->add($statement);
     }
     $retun->addParsedNamespaces($this->getParsedNamespaces());
     return $return;
 }
开发者ID:helenadeus,项目名称:s3db.map,代码行数:17,代码来源:InfModelB.php

示例6: getBaseMemModel

 /**
  * Create a MemModel containing only the base triples 
  * (without inferred statements) of the current InfModelF.
  *
  * @return object MemModel
  * @access public
  */
 function getBaseMemModel()
 {
     $return = new MemModel();
     $return->setBaseURI($this->baseURI);
     foreach ($this->triples as $key => $statement) {
         if (!in_array($key, $this->infPos)) {
             $return->add($statement);
         }
     }
     $retun->addParsedNamespaces($this->getParsedNamespaces());
     return $return;
 }
开发者ID:richardjennings,项目名称:rap,代码行数:19,代码来源:InfModelF.php

示例7: testNestBlankAtEnd

 function testNestBlankAtEnd()
 {
     $mod = new MemModel();
     $b3 = new BlankNode($mod);
     $mod->add(new Statement(new Resource('http://example.org/foo'), new Resource("http://example.org/bar2"), $b3));
     $ser = new N3Serializer();
     $ser->setCompress(true);
     $ser->setNest(true);
     $str = $ser->serialize($mod);
     //test if it can be loaded
     $par = new N3Parser();
     $mod2 = $par->parse2model($str, false);
     //var_dump($str, $mod2->triples);
     $this->compareModelsIgnoringBlankNodes($mod, $mod2);
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:15,代码来源:n3Serializer_test.php

示例8: MemModel

 /**
  *
  */
 function &rewriteURIsInResDescrModel(&$rd_m)
 {
     global $_PUBBY_DATASET;
     global $namespaces;
     $rew_rd_m = new MemModel();
     // uri rewriting + regex filtering
     if ($_PUBBY_DATASET['datasetURIPattern'] != '') {
         $l = strlen($_PUBBY_DATASET['datasetBase']);
         $iter = $rd_m->getStatementIterator();
         while ($iter->hasNext()) {
             $triple = $iter->next();
             $subj = $triple->getSubject();
             // if subjURI is a datasetURI & does not match the pattern
             if (stripos($subj->getURI(), $_PUBBY_DATASET['datasetBase']) === 0 && !preg_match($_PUBBY_DATASET['datasetURIPattern'], substr($subj->getURI(), $l))) {
                 continue;
             } else {
                 // if predURI is a datasetURI & does not match the pattern
                 $pred = $triple->getPredicate();
                 if (stripos($pred->getURI(), $_PUBBY_DATASET['datasetBase']) === 0 && !preg_match($_PUBBY_DATASET['datasetURIPattern'], substr($pred->getURI(), $l))) {
                     continue;
                 } else {
                     // if obj is a Literal & objeURI is a datasetURI & does not match the pattern
                     $obj = $triple->getObject();
                     if (!is_a($obj, "Literal")) {
                         if (stripos($obj->getURI(), $_PUBBY_DATASET['datasetBase']) === 0 && !preg_match($_PUBBY_DATASET['datasetURIPattern'], substr($obj->getURI(), $l))) {
                             continue;
                         } else {
                             $obj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($obj->getURI()));
                         }
                     }
                     $subj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($subj->getURI()));
                     $pred = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($pred->getURI()));
                     $rew_rd_m->add(new Statement($subj, $pred, $obj));
                 }
             }
         }
     } else {
         $iter = $rd_m->getStatementIterator();
         while ($iter->hasNext()) {
             $triple = $iter->next();
             $subj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($triple->getSubject()->getURI()));
             $pred = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($triple->getPredicate()->getURI()));
             $obj = $triple->getObject();
             if (!is_a($obj, "Literal")) {
                 $obj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($obj->getURI()));
             }
             $rew_rd_m->add(new Statement($subj, $pred, $obj));
         }
     }
     return $rew_rd_m;
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:54,代码来源:RAPpubbyURIrewriter.php

示例9: MemModel

 /**
  * finds a statement in an index. $pos is the Position in the index
  * and $ind the adequate searchindex
  *
  * @param    String            $pos
  * @param    Object Subject    &$subject
  * @param    Object Predicate  &$predicate
  * @param    Object Object	 &$object
  * @param    int				 &ind
  * @return   MemModel          $res
  * @access   private
  */
 function _findInIndex($pos, &$subject, &$predicate, &$object, $ind)
 {
     $res = new MemModel($this->getBaseURI());
     $res->indexed = -1;
     if (!isset($this->indexArr[$ind][$pos])) {
         return $res;
     }
     foreach ($this->indexArr[$ind][$pos] as $key => $value) {
         $t = $this->triples[$value];
         if ($this->matchStatement($t, $subject, $predicate, $object)) {
             $res->add($t);
         }
     }
     return $res;
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:27,代码来源:MemModel.php

示例10: MemModel

 function _generateModelLiteral($stats, $ind)
 {
     $model = new MemModel();
     $model->index($ind);
     for ($i = 0; $i < $stats; $i++) {
         $subs[$i] = new Resource('http://www.example.org/sub' . $i % 3);
         $preds[$i] = new Resource('http://www.example.org/pred' . $i % 5);
         $objs[$i] = new Literal('http://www.example.org/obj' . $i % 9);
         $objs[$i]->setDatatype('test');
     }
     for ($i = 0; $i < $stats; $i++) {
         $model->add(new Statement($subs[$i], $preds[$i], $objs[$i]));
     }
     return $model;
 }
开发者ID:Gigi33,项目名称:exif2rdf,代码行数:15,代码来源:RDFSF_BasicOperations_tests.php

示例11: addBookToModel

 private function addBookToModel(SimpleXMLElement $item, MemModel $model)
 {
     $itemresource = new Resource($this->uri);
     // rdf:type
     $model->add(new Statement($itemresource, new Resource(RDF_NAMESPACE_URI . RDF_TYPE), new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#Book")));
     // homepage (link to details page @ amazon)
     //$model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/homepage"),new Resource($item->DetailPageURL)));
     // label
     $model->add(new Statement($itemresource, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal((string) $item->ItemAttributes->Title)));
     // date
     $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/date"), new Literal((string) $item->ItemAttributes->PublicationDate)));
     // title
     $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/title"), new Literal((string) $item->ItemAttributes->Title)));
     //large image
     $model->add(new Statement($itemresource, new Resource("http://xmlns.com/foaf/0.1/depiction"), new Resource((string) $item->LargeImage->URL)));
     // thumbnail
     $model->add(new Statement($itemresource, new Resource("http://xmlns.com/foaf/0.1/thumbnail"), new Resource((string) $item->SmallImage->URL)));
     // isbn
     $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/identifier"), new Resource("urn:ISBN:" . $item->ItemAttributes->ISBN)));
     // publisher
     $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/publisher"), new Literal((string) $item->ItemAttributes->Label)));
     // format
     if (isset($item->ItemAttributes->format)) {
         $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/format"), new Literal((string) $item->ItemAttributes->format)));
     }
     if (isset($item->ItemAttributes->Binding)) {
         $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/format"), new Literal((string) $item->ItemAttributes->Binding)));
     }
     // reviews
     $i = 1;
     foreach ($item->EditorialReviews->EditorialReview as $index => $review) {
         $newuri = str_replace("/books/", "/reviews/", $this->uri);
         $pos = strrpos($newuri, "/");
         $review = new Resource($newuri . "_" . $index . $i);
         $model->add(new Statement($itemresource, new Resource("http://dannyayers.com/xmlns/rev/#hasReview"), $review));
         $model->add(new Statement($review, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal("Review number " . $i . " about: " . $item->ItemAttributes->Title)));
         $i++;
     }
     // author
     $newuri = str_replace("/books/", "/persons/", $this->uri);
     $pos = strrpos($newuri, "/");
     if (isset($item->ItemAttributes->Author)) {
         foreach ($item->ItemAttributes->Author as $k => $author) {
             $authorUri = new Resource(substr($newuri, 0, $pos + 1) . urlencode($author));
             $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/creator"), $authorUri));
             $model->add(new Statement($authorUri, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal((string) $author)));
         }
     }
     // subject(s)
     $newuri = str_replace("/books/", "/subject/", $this->uri);
     $skosSubject = new Resource("http://www.w3.org/2004/02/skos/core#subject");
     $pos = strrpos($newuri, "/");
     if (isset($item->Subjects)) {
         foreach ($item->Subjects as $k => $subjects) {
             foreach ($subjects as $kk => $subject) {
                 $subjectUri = new Resource(substr($newuri, 0, $pos + 1) . urlencode($subject));
                 $model->add(new Statement($itemresource, $skosSubject, $subjectUri));
                 $model->add(new Statement($subjectUri, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal((string) $subject)));
             }
         }
     }
     if (isset($item->ItemAttributes->Creator)) {
         foreach ($item->ItemAttributes->Creator as $key => $creator) {
             $creatorUri = new Resource(substr($newuri, 0, $pos + 1) . urlencode($creator));
             $model->add(new Statement($itemresource, new Resource("http://purl.org/dc/elements/1.1/creator"), $creatorUri));
             $model->add(new Statement($creatorUri, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal((string) $creator)));
         }
     }
     // amazon offer
     $newuri = str_replace("/books/", "/offers/", $this->uri);
     $pos = strrpos($newuri, "/");
     $offer = new Resource($newuri . "amazonOffer");
     $model->add(new Statement($itemresource, new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#hasOffer"), $offer));
     $model->add(new Statement($offer, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal("Offer for the book with the ISBN: " . $item->ItemAttributes->ISBN)));
     // create OFFER from google
     $this->addGoogleOffersToModel($model, $this->uri);
     //
     $model->add(new Statement(new Resource($this->document), new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal("RDF document about the book: " . $item->ItemAttributes->Title)));
 }
开发者ID:richardjennings,项目名称:rap,代码行数:79,代码来源:ApiQueryService.php

示例12: MemModel

// Include RAP
define("RDFAPI_INCLUDE_DIR", "./../api/");
include RDFAPI_INCLUDE_DIR . "RdfAPI.php";
// Filename of an RDF document
$base = "example1.rdf";
// Create a new MemModel
$model = new MemModel();
// Load and parse document
$model->load($base);
// Output model as HTML table
$model->writeAsHtmlTable();
echo "<P>";
// Ceate new statements and add them to the model
$statement1 = new Statement(new Resource("http://www.w3.org/Home/Lassila"), new Resource("http://description.org/schema/Description"), new Literal("Lassila's personal Homepage", "en"));
$statement2 = new Statement(new Resource("http://www.w3.org/Home/Lassila"), new Resource("http://description.org/schema/Description"), new Literal("Lassilas persönliche Homepage ", "de"));
$model->add($statement1);
$model->add($statement2);
$model->writeAsHtmlTable();
echo "<P>";
// Search model 1
$homepage = new Resource("http://www.w3.org/Home/Lassila");
$res = $model->find($homepage, NULL, NULL);
$res->writeAsHtmlTable();
echo "<P>";
// Search model 2
$description = new Resource("http://description.org/schema/Description");
$statement = $model->findFirstMatchingStatement($homepage, $description, NULL);
// Check if something was found and output result
if ($statement) {
    echo $statement->toString();
} else {
开发者ID:Gigi33,项目名称:exif2rdf,代码行数:31,代码来源:test_ManipulateMemModel.php

示例13: _getAttributes

 /**
  * Search the attributes listed in $list in the dataset.
  * Modifies $resultGraph
  *
  * @param Array      $list List containing the attributes
  * @param MemModel   $resultGraph The result graph which describes the Resource
  * @return void
  */
 protected function _getAttributes($list, $resultGraph, $varvalue)
 {
     if ($list) {
         foreach ($list as $attribute) {
             if (!$varvalue instanceof Literal) {
                 $iter2 = $this->dataset->findInNamedGraphs(null, $varvalue, new Resource($attribute), null, true);
                 while ($iter2->valid()) {
                     $resultGraph->add($iter2->current());
                     $iter2->next();
                 }
                 $iter3 = $this->dataset->findInDefaultGraph($varvalue, new Resource($attribute), null);
                 while ($iter3->valid()) {
                     $resultGraph->add($iter3->current());
                     $iter3->next();
                 }
             }
         }
     }
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:27,代码来源:Default.php

示例14: RdqlParser

 /**
  * Perform an RDQL query on this Model. Should work with all types of models.
  * This method returns a MemModel containing the result statements.
  * If $closure is set to TRUE, the result will additionally contain
  * statements found by the findForward-method for blank nodes.
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  * WARNING: If called with $closure = TRUE this method
  *          can be slow with large models.
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  *
  * @author   Anton K�tlbacher <anton1@koestlbacher.de>
  * @author   code snippets taken from the RAP Netapi by Phil Dawes and Chris Bizer
  * @access   public
  * @param    string $queryString
  * @param    boolean $closure
  * @return   object MemModel
  *
  */
 function &getMemModelByRDQL($queryString, $closure = FALSE)
 {
     require_once RDFAPI_INCLUDE_DIR . PACKAGE_RDQL;
     $parser = new RdqlParser();
     $parsedQuery =& $parser->parseQuery($queryString);
     // If there are variables used in the pattern but not
     // in the select clause, add them to the select clause
     foreach ($parsedQuery['patterns'] as $n => $pattern) {
         foreach ($pattern as $key => $val_1) {
             if ($val_1['value'][0] == '?') {
                 if (!in_array($val_1['value'], $parsedQuery['selectVars'])) {
                     array_push($parsedQuery['selectVars'], $val_1['value']);
                 }
             }
         }
     }
     if (is_a($this, "DbModel")) {
         $engine = new RdqlDbEngine();
         $model = $this;
     } elseif (is_a($this, "MemModel")) {
         $engine = new RdqlMemEngine();
         $model = $this;
     } elseif (is_a($this, "ResModel")) {
         $engine = new RdqlMemEngine();
         $model = $this->model;
     }
     $res = $engine->queryModel($model, $parsedQuery, TRUE);
     $rdqlIter = new RdqlResultIterator($res);
     $newModel = new MemModel();
     // Build statements from RdqlResultIterator
     while ($rdqlIter->hasNext()) {
         $result = $rdqlIter->next();
         foreach ($parsedQuery['patterns'] as $n => $pattern) {
             if (substr($pattern['subject']['value'], 0, 1) == '?') {
                 $subj = $result[$pattern['subject']['value']];
             } else {
                 $subj = new Resource($pattern['subject']['value']);
             }
             if (substr($pattern['predicate']['value'], 0, 1) == '?') {
                 $pred = $result[$pattern['predicate']['value']];
             } else {
                 $pred = new Resource($pattern['predicate']['value']);
             }
             if (substr($pattern['object']['value'], 0, 1) == '?') {
                 $obj = $result[$pattern['object']['value']];
             } else {
                 if (isset($pattern['object']['is_literal'])) {
                     $obj = new Literal($pattern['object']['value']);
                     $obj->setDatatype($pattern['object']['l_dtype']);
                     $obj->setLanguage($pattern['object']['l_lang']);
                 } else {
                     $obj = new Resource($pattern['object']['value']);
                 }
             }
             $statement = new Statement($subj, $pred, $obj);
             $newModel->add($statement);
             // findForward() Statements containing an eventually given blank node
             // and add them to the result, if closure = true
             if (is_a($statement->object(), 'BlankNode') && $closure == True) {
                 $newModel = $model->findForward($statement->object(), NULL, NULL, $newModel);
             }
             if (is_a($statement->subject(), 'BlankNode') && $closure == True) {
                 $newModel = $model->findForward($statement->subject(), NULL, NULL, $newModel);
             }
         }
     }
     return $newModel;
 }
开发者ID:p4535992,项目名称:programate,代码行数:86,代码来源:Model.php

示例15: MemModel

<?php 
define("RDFAPI_INCLUDE_DIR", "./../api/");
include RDFAPI_INCLUDE_DIR . "RdfAPI.php";
echo "<h3>1. Generate and show two MemModels</h3>";
// Create empty MemModel
$model = new MemModel();
$model->setbaseURI("http://www.bizer.de");
$model2 = new MemModel();
$model2->setbaseURI("http://www.bizer.de/zwei");
// Create nodes and add statements to models
$myhomepage = new Resource("http://www.bizer.de/welcome.html");
$creator = new Resource("http://purl.org/dc/elements/1.1/creator");
$me = new Resource("mailto:chris@bizer.de");
$model->add(new Statement($myhomepage, $creator, $me));
$model2->add(new Statement($myhomepage, $creator, $me));
$creation_date = new Resource("http://www.example.org/terms/creation-date");
$August16 = new Literal("August 16, 2002");
$model->add(new Statement($myhomepage, $creation_date, $August16));
$model2->add(new Statement($myhomepage, $creation_date, $August16));
$language = new Resource("http://www.example.org/terms/language");
$deutsch = new Literal("Deutsch", "de");
$model->add(new Statement($myhomepage, $language, $deutsch));
$name = new Resource("http://www.example.org/terms/Name");
$chrisbizer = new Literal("Chris Bizer");
$model2->add(new Statement($me, $name, $chrisbizer));
// Output as Table
echo "<h5>Model 1</h5>";
$model->writeAsHtmlTable();
echo "<h5>Model 2</h5>";
$model2->writeAsHtmlTable();
开发者ID:Gigi33,项目名称:exif2rdf,代码行数:30,代码来源:test_setoperations.php


注:本文中的MemModel::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。