本文整理汇总了PHP中MemModel类的典型用法代码示例。如果您正苦于以下问题:PHP MemModel类的具体用法?PHP MemModel怎么用?PHP MemModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MemModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: _doFindFromFile
function _doFindFromFile($file, &$model)
{
$nullVarURIs = array('var:x', 'var:y', 'var:z');
$mod = new MemModel();
$mod->load($file);
$return = new MemModel();
foreach ($mod->triples as $statement) {
if (in_array($statement->getLabelSubject(), $nullVarURIs)) {
$findS = null;
} else {
$findS = $statement->getSubject();
}
if (in_array($statement->getLabelPredicate(), $nullVarURIs)) {
$findP = null;
} else {
$findP = $statement->getPredicate();
}
if (in_array($statement->getLabelObject(), $nullVarURIs)) {
$findO = null;
} else {
$findO = $statement->getObject();
}
$return->addModel($model->find($findS, $findP, $findO));
}
return $return;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:26,代码来源:RDFSF_jena_rdfs_test.php
示例3: testSerialize
function testSerialize()
{
$ser = new JsonSerializer();
$jsonString = $ser->serialize($this->model);
$memModel = new MemModel();
$memModel->loadFromString($jsonString, 'json');
$this->assertTrue($this->model->equals($memModel));
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:8,代码来源:jsonSerializer_test.php
示例4: _generateModel
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
示例5: 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
示例6: testRdfParser
function testRdfParser()
{
$_SESSION['test'] = 'Rdf- Parser Empty Resource test';
$mod1 = new MemModel();
$mod2 = new MemModel();
$mod1->load('emptyResource.rdf');
$mod2->load('emptyResource_serialized.rdf');
if ($mod1->equals($mod2)) {
$pass = true;
} else {
$pass = false;
}
$this->assertTrue($pass);
}
开发者ID:Gigi33,项目名称:exif2rdf,代码行数:14,代码来源:rdf_Parser_tests.php
示例7: testIsEquals
function testIsEquals()
{
foreach ($_SESSION['rdf_positive_tests'] as $key => $value) {
$model1 = new MemModel();
$model2 = new MemModel();
$file = $value;
$_SESSION['test'] =& $value;
$_SESSION['key'] =& $key;
$model1->load(TESTCASES_DIR . $file . ".rdf");
$_SESSION['mod1'] = $model1;
$model2->load(TESTCASES_DIR . $file . ".nt");
$_SESSION['mod2'] = $model2;
$this->assertTrue($model1->equals($model2));
}
}
开发者ID:Gigi33,项目名称:exif2rdf,代码行数:15,代码来源:rdf_test_cases.php
示例8: loadNamespaces
/**
* loads namespaces from file or rewrites from configuration model
*/
function loadNamespaces($url)
{
if ($url) {
$nmsp_m = new MemModel();
$nmsp_m->load($url);
$this->ns = $nmsp_m->getParsedNamespaces();
if (!$this->ns) {
trigger_error("The file:" . $url . "does not contain any namespace declarations." . "The prefixes from the configuration model will be used instead");
}
} else {
$nmsp = $this->m->getParsedNamespaces();
if ($nmsp) {
$this->ns = RAPpubbyURIrewriter::rewrNamespaces($nmsp);
}
}
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:19,代码来源:RAPpubbyDataset.php
示例9: testOverwritingDefaultParser
/**
* parser overwrites the prefixes defined in the default_prefixes array
*/
function testOverwritingDefaultParser()
{
$_SESSION['test'] = 'Overwriting default parser test';
$string = "<?xml version='1.0'?>\n \t\t\t\t<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n \t\t\txmlns:exterms='http://www.example.org/terms/'>\n\t\t\t\t\t<rdf:Description rdf:about='http://www.example.org/index.html'>\n\t\t\t\t\t\t<exterms:creation-date>August 16, 1999</exterms:creation-date>\n\t\t\t\t\t</rdf:Description>\n\t\t\t\t</rdf:RDF>";
// delete default prefixes
global $default_prefixes;
$backup = $default_prefixes;
foreach ($default_prefixes as $name => $pref) {
unset($default_prefixes[$name]);
}
$default_prefixes = array('foo' => RDF_NAMESPACE_URI);
$model = new MemModel();
$model->load($string);
$nmsp = $model->getParsedNamespaces();
$this->assertEqual($nmsp[RDF_NAMESPACE_URI], 'rdf');
$default_prefixes = $backup;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:20,代码来源:Namespace_handling_tests.php
示例10: testRdfSerializer
function testRdfSerializer()
{
$_SESSION['test'] = 'Rdf- Parser Empty Resource test';
$mod1 = new MemModel();
$mod2 = new MemModel();
$mod3 = new MemModel();
$mod1->load('multipleTypes.rdf');
$mod1->saveAs('mt1.rdf', 'rdf');
$mod3->load('mt1.rdf');
$mod2->load('multipleTypes.rdf');
$_SESSION['mod1'] = $mod3;
$_SESSIOn['mod2'] = $mod2;
if ($mod3->equals($mod2)) {
$pass = true;
} else {
$pass = false;
}
$this->assertTrue($pass);
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:19,代码来源:rdf_Serializer_tests.php
示例11: _generateModel
/**
* generates a test model containing given number of statements
* and given indextype.
*
* @return Object MemModel $model
* @param int $num
* @param int $des
* @param int $ind
* @param Object MemModel $needle
*/
function _generateModel($num, $des, $ind, $needle)
{
$model = new MemModel();
// generate Subjects
for ($i = 0; $i < $num; $i++) {
$subs[$i] = new Resource('http://www.example.org/Subject' . $i % 6);
}
// generate Predicates
for ($i = 0; $i < $num; $i++) {
$preds[$i] = new Resource('http://www.example.org/Predicate' . $i % 7);
}
// generate Objects
for ($i = 0; $i < $num; $i++) {
$objs[$i] = new Resource('http://www.example.org/Object' . $i % 5);
}
for ($i = 0; $i < $num; $i++) {
$model->add(new Statement($subs[$i], $preds[$i], $objs[$i]));
}
$model->index($ind);
return $model;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:31,代码来源:mm_index_tests.php
示例12: spoQuery
/**
* SPO (also known as "Triples" or "find(spo)") is an experimental minimal query language.
* An SPO query is a single triple pattern, with optional subject (parameter "s"), predicate (parameter "p"),
* and object (parameter "o", if a URIref, parameter "v" for a string literal).
* Absence of a parameter implies "any" for matching that slot of the triple pattern.
*
* @version $Id: spo.php 268 2006-05-15 05:28:09Z tgauss $
* @author Chris Bizer <[email protected]>
* @author Phil Dawes <[email protected]>
*
* @package netapi
* @todo Support typed literals.
* @access public
*/
function spoQuery($model, $serializer, $remove = false, $modelId = false)
{
// Get SPO query from HTTP request
if (isset($_REQUEST['s'])) {
$subject = new Resource($_REQUEST['s']);
} else {
$subject = NULL;
}
if (isset($_REQUEST['p'])) {
$predicate = new Resource($_REQUEST['p']);
} else {
$predicate = NULL;
}
if (isset($_REQUEST['o'])) {
$object = new Resource($_REQUEST['o']);
} else {
if (isset($_REQUEST['v'])) {
$object = new Literal($_REQUEST['v']);
} else {
$object = NULL;
}
}
if (isset($_REQUEST['closure'])) {
if (strtoupper($_REQUEST['closure']) == "TRUE") {
$closure = True;
} else {
$closure = False;
}
} else {
$closure = False;
}
$outm = new MemModel();
$resultmodel = $model->find($subject, $predicate, $object);
$it = $resultmodel->getStatementIterator();
while ($it->hasNext()) {
$stmt = $it->next();
if ($remove) {
$model->remove($stmt);
} else {
$outm->add(new Statement($stmt->subject(), $stmt->predicate(), $stmt->object()));
if (is_a($stmt->object(), 'BlankNode') && $closure == True) {
getBNodeClosure($stmt->object(), $model, $outm);
}
if (is_a($stmt->subject(), 'BlankNode') && $closure == True) {
getBNodeClosure($stmt->subject(), $model, $outm);
}
}
}
if ($remove) {
if (substr($modelId, 0, 5) == "file:") {
$model->saveAs(substr($modelId, 5));
}
if ($resultmodel->size() > 0) {
header('200 - OK');
echo "200 - OK";
} else {
echo "No matching statements";
}
} else {
echo $serializer->Serialize($outm);
}
$outm->close();
}
开发者ID:Gigi33,项目名称:exif2rdf,代码行数:77,代码来源:spo.php
示例13: _generateRDF
function _generateRDF()
{
$model = new MemModel();
$model->setBaseURI($this->doclink);
$proc = new xsltprocessor();
include_once RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF;
$pars = new RdfParser();
foreach ($this->stylelink as $key => $value) {
$xsl = new DomDocument();
$xsl->load($value);
$proc->importStyleSheet($xsl);
$model->addModel($pars->generateModel($proc->transformToXML($this->domdoc), $this->doclink));
}
return $model;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:15,代码来源:GRDDLParser.php
示例14: define
<?php
// Include RAP
define("RDFAPI_INCLUDE_DIR", "./../api/");
include RDFAPI_INCLUDE_DIR . "RdfAPI.php";
## 1. Connect to MsAccess database (via ODBC)
## ------------------------------------------
// Connect to MsAccess (rdf_db DSN) database using connection settings
// defined in constants.php :
$rdf_database = new DbStore();
## 2. Store a memory model in database.
## ------------------------------------
// Load an RDF-Documtent into a memory model
// Filename of an RDF document
$base = "example1.rdf";
// Create a new memory model
$memModel = new MemModel();
// Load and parse document
$memModel->load($base);
// Now store the model in database
// An unique modelURI will be generated
$rdf_database->putModel($memModel);
// You can also provide an URI for the model to be stored
$modelURI = "example1.rdf";
// But then you must check if there already is a model with the same modelURI
// otherwise the method putModel() will return FALSE
if ($rdf_database->modelExists($modelURI)) {
echo "Model with the same URI: '{$modelURI}' already exists";
} else {
$rdf_database->putModel($memModel, $modelURI);
}
## 3. Create a new database model
开发者ID:Gigi33,项目名称:exif2rdf,代码行数:31,代码来源:test_StoringModelsInDatabase.php
示例15: 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
示例16: constructGraph
/**
* Constructs a result graph.
*
* @param array $arVartable A table containing the result vars and their bindings
* @param GraphPattern $constructPattern The CONSTRUCT pattern
* @return MemModel The result graph which matches the CONSTRUCT pattern
*/
protected function constructGraph($arVartable, $constructPattern)
{
$resultGraph = new MemModel();
if (!$arVartable) {
return $resultGraph;
}
$tp = $constructPattern->getTriplePatterns();
$bnode = 0;
foreach ($arVartable as $value) {
foreach ($tp as $triple) {
$sub = $triple->getSubject();
$pred = $triple->getPredicate();
$obj = $triple->getObject();
if (is_string($sub) && $sub[1] == '_') {
$sub = new BlankNode("_bN" . $bnode);
}
if (is_string($pred) && $pred[1] == '_') {
$pred = new BlankNode("_bN" . $bnode);
}
if (is_string($obj) && $obj[1] == '_') {
$obj = new BlankNode("_bN" . $bnode);
}
if (is_string($sub)) {
$sub = $value[$sub];
}
if (is_string($pred)) {
$pred = $value[$pred];
}
if (is_string($obj)) {
$obj = $value[$obj];
}
if ($sub !== "" && $pred !== "" && $obj !== "") {
$resultGraph->add(new Statement($sub, $pred, $obj));
}
}
$bnode++;
}
return $resultGraph;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:46,代码来源:Default.php
示例17: MemModel
/**
* Reifies a statement.
* Returns a new MemModel that is the reification of the statement.
* For naming the statement's bNode a Model or bNodeID must be passed to the method.
*
* @access public
* @param mixed &$model_or_bNodeID
* @return object model
*/
function &reify(&$model_or_bNodeID)
{
if (is_a($model_or_bNodeID, 'MemModel')) {
// parameter is model
$statementModel = new MemModel($model_or_bNodeID->getBaseURI());
$thisStatement = new BlankNode($model_or_bNodeID);
} else {
// parameter is bNodeID
$statementModel = new MemModel();
$thisStatement =& $model_or_bNodeID;
}
$RDFstatement = new Resource(RDF_NAMESPACE_URI . RDF_STATEMENT);
$RDFtype = new Resource(RDF_NAMESPACE_URI . RDF_TYPE);
$RDFsubject = new Resource(RDF_NAMESPACE_URI . RDF_SUBJECT);
$RDFpredicate = new Resource(RDF_NAMESPACE_URI . RDF_PREDICATE);
$RDFobject = new Resource(RDF_NAMESPACE_URI . RDF_OBJECT);
$statementModel->add(new Statement($thisStatement, $RDFtype, $RDFstatement));
$statementModel->add(new Statement($thisStatement, $RDFsubject, $this->getSubject()));
$statementModel->add(new Statement($thisStatement, $RDFpredicate, $this->getPredicate()));
$statementModel->add(new Statement($thisStatement, $RDFobject, $this->Object()));
return $statementModel;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:31,代码来源:Statement.php
示例18: define
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Traverse MemModel</title>
</head>
<body>
<?php
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);
// Get Iterator from model
$it = $model->getStatementIterator();
// Traverse model and output statements
while ($it->hasNext()) {
$statement = $it->next();
echo "Statement number: " . $it->getCurrentPosition() . "<BR>";
echo "Subject: " . $statement->getLabelSubject() . "<BR>";
echo "Predicate: " . $statement->getLabelPredicate() . "<BR>";
echo "Object: " . $statement->getLabelObject() . "<P>";
}
// Move to the last statement and print it
$it->moveLast();
$statement = $it->current();
// Traverse model backward and print statements
echo $statement->toString() . "<BR>";
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:31,代码来源:test_TraverseModel.php
示例19: 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
示例20: 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
注:本文中的MemModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论