本文整理汇总了PHP中MemModel::addModel方法的典型用法代码示例。如果您正苦于以下问题:PHP MemModel::addModel方法的具体用法?PHP MemModel::addModel怎么用?PHP MemModel::addModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemModel
的用法示例。
在下文中一共展示了MemModel::addModel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
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;
}
示例2: getSchema
/**
* Returns a model, containing all Statements, having a Predicate, that
* is supported by the inference.
*
* @return object Model
* @access public
*/
function getSchema()
{
$res = new MemModel();
//Search the base-model for all statements, having a Predicate, that
//is supported by the inference.
foreach ($this->supportedInference as $inferencePredicateLabel) {
$res->addModel($this->find(null, new Resource($inferencePredicateLabel), null));
}
return $res;
}
示例3: MemModel
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;
}
示例4: RDFSBModel
/**
*
*/
function test1()
{
$inf = new RDFSBModel('http://myRDFSFModel.com');
$result = new MemModel();
$parser = new N3Parser();
$inf->addModel($parser->parse2model('
<http://example.org/baz1> <http://example.org/bat> <http://example.org/baz2> .
<http://example.org/bat> <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> <http://example.org/bas> .
'));
$result->addModel($parser->parse2model('
@prefix ns0: <http://example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
ns0:baz1 ns0:bas ns0:baz2 ; ns0:bat ns0:baz2 .
ns0:bat rdfs:subPropertyOf ns0:bas .
'));
$this->assertTrue($inf->equals($result));
//next test
$inf->add(new Statement(new Resource('http://example.org/bat'), new Resource('http://www.w3.org/2000/01/rdf-schema#domain'), new Resource('http://example.org/Domain1')));
$inf->add(new Statement(new Resource('http://example.org/bat'), new Resource('http://www.w3.org/2000/01/rdf-schema#range'), new Resource('http://example.org/Range1')));
$result = new MemModel();
$result->addModel($parser->parse2model('
@prefix ns0: <http://example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ns0:baz1 ns0:bas ns0:baz2 ; ns0:bat ns0:baz2 ; a ns0:Domain1 .
ns0:bat rdfs:domain ns0:Domain1 ; rdfs:range ns0:Range1 ; rdfs:subPropertyOf ns0:bas .
ns0:baz2 a ns0:Range1 .
'));
$this->assertTrue($inf->equals($result));
// next test
$inf->add(new Statement(new Resource('http://example.org/bas'), new Resource('http://www.w3.org/2000/01/rdf-schema#domain'), new Resource('http://example.org/Domain2')));
$inf->add(new Statement(new Resource('http://example.org/bas'), new Resource('http://www.w3.org/2000/01/rdf-schema#range'), new Resource('http://example.org/Range2')));
$result = new MemModel();
$result->addModel($parser->parse2model('
@prefix ns0: <http://example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ns0:baz1 ns0:bas ns0:baz2 ; ns0:bat ns0:baz2 ; a ns0:Domain1 , ns0:Domain2 .
ns0:bat rdfs:domain ns0:Domain1 ; rdfs:range ns0:Range1 ; rdfs:subPropertyOf ns0:bas .
ns0:bas rdfs:domain ns0:Domain2 ; rdfs:range ns0:Range2 .
ns0:baz2 a ns0:Range1 , ns0:Range2 .
'));
$this->assertTrue($inf->equals($result));
//next test
$inf->add(new Statement(new Resource('http://example.org/Domain2'), new Resource('http://www.w3.org/2000/01/rdf-schema#subClassOf'), new Resource('http://example.org/Domain3')));
$inf->add(new Statement(new Resource('http://example.org/Domain3'), new Resource('http://www.w3.org/2000/01/rdf-schema#subClassOf'), new Resource('http://example.org/Domain2')));
$result = new MemModel();
$result->addModel($parser->parse2model('
@prefix ns0: <http://example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ns0:baz1 ns0:bas ns0:baz2 ; ns0:bat ns0:baz2 ; a ns0:Domain1 , ns0:Domain2 , ns0:Domain3 .
ns0:bat rdfs:domain ns0:Domain1 ; rdfs:range ns0:Range1 ; rdfs:subPropertyOf ns0:bas .
ns0:bas rdfs:domain ns0:Domain2 ; rdfs:range ns0:Range2 .
ns0:baz2 a ns0:Range1 , ns0:Range2 .
ns0:Domain3 rdfs:subClassOf ns0:Domain2 .
ns0:Domain2 rdfs:subClassOf ns0:Domain3 .
'));
$this->assertTrue($inf->equals($result));
//next test
$inf->add(new Statement(new Resource('http://example.org/Range3'), new Resource('http://www.w3.org/2002/07/owl#sameAs'), new Resource('http://example.org/Range2')));
$result = new MemModel();
$result->addModel($parser->parse2model('
@prefix ns0: <http://example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
ns0:baz1 ns0:bas ns0:baz2 ; ns0:bat ns0:baz2 ; a ns0:Domain1 , ns0:Domain2 , ns0:Domain3 .
ns0:baz2 a ns0:Range1 , ns0:Range2 , ns0:Range3 .
ns0:bat rdfs:domain ns0:Domain1 ; rdfs:range ns0:Range1 ; rdfs:subPropertyOf ns0:bas .
ns0:bas rdfs:domain ns0:Domain2 ; rdfs:range ns0:Range2 .
ns0:Range3 owl:sameAs ns0:Range2 .
ns0:Domain3 rdfs:subClassOf ns0:Domain2 .
ns0:Domain2 rdfs:subClassOf ns0:Domain3 .
'));
$this->assertTrue($inf->equals($result));
//next test
$findResult = $inf->find(new Resource('http://example.org/baz2'), null, null);
$result = new MemModel();
$result->addModel($parser->parse2model('
@prefix ns0: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ns0:baz2 a ns0:Range1 , ns0:Range2 , ns0:Range3 .
'));
$this->assertTrue($findResult->equals($result));
//text test
$inf->remove(new Statement(new Resource('http://example.org/bat'), new Resource('http://www.w3.org/2000/01/rdf-schema#subPropertyOf'), new Resource('http://example.org/bas')));
$result = new MemModel();
$result->addModel($parser->parse2model('
@prefix ns0: <http://example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ns0:baz1 ns0:bat ns0:baz2 ; a ns0:Domain1 .
ns0:bas rdfs:domain ns0:Domain2 ; rdfs:range ns0:Range2 .
ns0:bat rdfs:domain ns0:Domain1 ; rdfs:range ns0:Range1 .
ns0:baz2 a ns0:Range1 .
//.........这里部分代码省略.........