/** * Constructor */ public function __construct(Erfurt_Store $store, $graph, $uri, $limit = false) { parent::__construct($store, $graph); $this->_uri = (string) $uri; $this->_titleHelper = new OntoWiki_Model_TitleHelper($this->_model); if ($limit !== false) { $this->_limit = $limit; } //TODO fix query $queryHidden = 'PREFIX sysont: <http://ns.ontowiki.net/SysOnt/> SELECT ?p WHERE {?p sysont:hidden ?o }'; $res = $store->sparqlQuery($queryHidden, array("result_format" => Erfurt_Store::RESULTFORMAT_EXTENDED)); if (isset($res['bindings'])) { $bindings = $res['bindings']; } else { if (isset($res['results']['bindings'])) { $bindings = $res['results']['bindings']; } else { require_once 'OntoWiki/Model/Exception.php'; throw new OntoWiki_Model_Exception('invalid query result.'); } } foreach ($bindings as $b) { $this->_ignoredPredicates[] = $b['p']['value']; } }
/** * Constructor * * @see OntoWiki_Model_Abstract */ public function __construct(Erfurt_Store $store, $graph, array $options = array()) { parent::__construct($store, $graph); $this->_options = array_merge($this->_options, $options); $this->_current = (string) OntoWiki::getInstance()->selectedResource; $this->_session = OntoWiki::getInstance()->session; // HACK: if the graph itself is one that is normally ignored in other // models, don't ignore it if (in_array($this->_graph, $this->_options['ignore_ns'])) { // TODO: remove only graph and imported namespaces $this->_options['ignore_ns'] = array(); } }
/** * Constructor */ public function __construct(Erfurt_Store $store, Erfurt_Rdf_Model $model, $options = array()) { parent::__construct($store, $model); if (isset($options[Erfurt_Store::USE_CACHE])) { $this->_useCache = $options[Erfurt_Store::USE_CACHE]; } //TODO still needed? $this->_defaultUrl['resource'] = new OntoWiki_Url(array('route' => 'properties'), array()); $this->_defaultUrlParam['resource'] = 'r'; $this->_resourceQuery = new Erfurt_Sparql_Query2(); $this->_resourceVar = new Erfurt_Sparql_Query2_Var('resourceUri'); $this->_owApp = OntoWiki::getInstance(); $this->_config = $this->_owApp->config; $this->_allTriple = new Erfurt_Sparql_Query2_Triple($this->_resourceVar, new Erfurt_Sparql_Query2_Var('p'), new Erfurt_Sparql_Query2_Var('o')); $this->addAllTriple(); //show resource uri $this->_resourceQuery->addProjectionVar($this->_resourceVar); $this->_resourceQuery->setLimit(10)->setDistinct(true); //->getOrder() // ->add($this->_resourceVar); // when resourceVar is the object - prevent literals $this->_resourceQuery->addFilter(new Erfurt_Sparql_Query2_ConditionalAndExpression(array(new Erfurt_Sparql_Query2_UnaryExpressionNot(new Erfurt_Sparql_Query2_isBlank($this->_resourceVar))))); //build value query $this->_valueQuery = new Erfurt_Sparql_Query2(); $this->_valueQuery->addProjectionVar($this->_resourceVar)->setDistinct(true); if (!isset($this->_config->lists) || $this->_config->lists->showTypeColumnByDefault === 'true') { $this->addShownProperty(EF_RDF_TYPE, '__TYPE'); } //set froms to the requested graph $this->_valueQuery->addFrom((string) $model); $this->_resourceQuery->addFrom((string) $model); $this->invalidate(); }