/**
  * Get the output string for a query in debugging mode.
  *
  * @param $query SMWQuery
  * @return string
  */
 public function getDebugQueryResult(SMWQuery $query)
 {
     $this->m_sortkeys = $query->sortkeys;
     $sparqlCondition = $this->getSparqlCondition($query->getDescription());
     $entries = array();
     if ($sparqlCondition instanceof SMWSparqlSingletonCondition) {
         if ($sparqlCondition->condition === '') {
             // all URIs exist, no querying
             $sparql = 'None (no conditions).';
         } else {
             $condition = $this->getSparqlConditionString($sparqlCondition);
             $namespaces = $sparqlCondition->namespaces;
             $sparql = smwfGetSparqlDatabase()->getSparqlForAsk($condition, $namespaces);
         }
     } elseif ($sparqlCondition instanceof SMWSparqlFalseCondition) {
         $sparql = 'None (conditions can not be satisfied by anything).';
     } else {
         $condition = $this->getSparqlConditionString($sparqlCondition);
         $namespaces = $sparqlCondition->namespaces;
         $options = $this->getSparqlOptions($query, $sparqlCondition);
         $options['DISTINCT'] = true;
         $sparql = smwfGetSparqlDatabase()->getSparqlForSelect('?' . self::RESULT_VARIABLE, $condition, $options, $namespaces);
     }
     $sparql = str_replace(array('[', ':', ' '), array('[', ':', ' '), $sparql);
     $entries['SPARQL Query'] = "<pre>{$sparql}</pre>";
     return SMWStore::formatDebugOutput('SMWSparqlStore', $entries, $query);
 }
Exemplo n.º 2
0
 /**
  * @see SMWStore::drop()
  * @since 1.6
  */
 public function drop($verbose = true)
 {
     $this->baseStore->drop($verbose);
     smwfGetSparqlDatabase()->delete("?s ?p ?o", "?s ?p ?o");
 }
	/**
	 * Convenience method for deleting all triples that have a subject that
	 * occurs in a triple with the given property and object. This is used
	 * in SMW to delete subobjects with all their data. Some RDF stores fail
	 * on complex delete queries, hence a wrapper function is provided to
	 * allow more pedestrian implementations.
	 *
	 * The function declares the standard namespaces wiki, swivt, rdf, owl,
	 * rdfs, property, xsd, so these do not have to be included in
	 * $extraNamespaces.
	 *
	 * @param $propertyName string Turtle name of marking property
	 * @param $objectName string Turtle name of marking object/value
	 * @param $extraNamespaces array (associative) of namespaceId => namespaceUri
	 * @return boolean stating whether the operations succeeded
	 */
	public function deleteContentByValue( $propertyName, $objectName, $extraNamespaces = array() ) {
		return smwfGetSparqlDatabase()->delete( "?s ?p ?o", "?s $propertyName $objectName . ?s ?p ?o" );
	}
	public function drop( $verbose = true ) {
		parent::drop( $verbose );
		smwfGetSparqlDatabase()->delete( "?s ?p ?o", "?s ?p ?o" );
	}