This class provides methods for manipulating DbModels from DbStore.
A DbModel is an RDF Model, which is persistently stored in a relational database. This Class uses the ADOdb Database Abstraction Library for PHP (http://adodb.sourceforge.net/).
Located in /model/DbModel.php (line 22)
Object | --Model | --DbModel
Class | Description |
---|---|
NamedGraphDb | Persistent NamedGraph implementation that extends a DbModel. |
Constructor Do not call this directly.
Use the method getModel,getNewModel or putModel of the Class DbStore instead.
Add the given model to this DbModel.
This function monitors for SQL errors, and will commit if no errors have occured, otherwise it will rollback. If any statement of the model to be added to this model contains a blankNode with an identifier already existing in this model, a new blankNode is generated.
Adds a namespace and prefix to the model.
Adds the namespaces to the model. This method is called by the parser. !!!! addParsedNamespaces() not overwrites manual added namespaces in the model !!!!
Determine if all of the statements in the given model are also contained in this DbModel.
Determine if any of the statements in the given model are also contained in this DbModel.
Remove this DbModel from database and clean up.
This function monitors for SQL errors, and will commit if no errors have occured, otherwise it will rollback.
Check if two models are equal.
Two models are equal if and only if the two RDF graphs they represent are isomorphic.
Warning: This method doesn't work correct with models where the same blank node has different identifiers in the two models. We will correct this in a future version.
General method to search for triples in the DbModel.
NULL input for any parameter will match anything. Example: $result = $m->find( NULL, NULL, $node ); Finds all triples with $node as object.
Search for triples and return the number of matches.
NULL input for any parameter will match anything.
Search for triples and return the first matching statement.
NULL input for any parameter will match anything. Return an NULL if nothing is found. You can set an search offset with $offset.
Method to search for triples using Perl-style regular expressions.
NULL input for any parameter will match anything. Example: $result = $m->find_regex( NULL, NULL, $regex ); Finds all triples where the label of the object node matches the regular expression. Return an empty MemModel if nothing is found. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING: Mhis method loads a DbModel into memory and performs the search on a MemModel, which can be slow with large models. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Return all tripels of a certain vocabulary.
$vocabulary is the namespace of the vocabulary inluding a # : / char at the end. e.g. http://www.w3.org/2000/01/rdf-schema# Return an empty model if nothing is found.
Create a MemModel containing all the triples of the current DbModel.
Return a new MemModel containing all the statements which are in both this model and the given model.
Returns a FindIterator for traversing the MemModel.
Perform an RDQL query on this DbModel.
This method returns an associative array of variable bindings. The values of the query variables can either be RAP's objects (instances of Node) if $returnNodes set to TRUE, or their string serialization.
Perform an RDQL query on this DBModel.
This method returns an RdqlResultIterator of variable bindings. The values of the query variables can either be RAP's objects (instances of Node) if $returnNodes set to TRUE, or their string serialization.
Reify the DbModel.
Return a new MemModel that contains the reifications of all statements of this DbModel.
removes a single namespace from the model
General method to replace nodes of a DbModel.
NULL input for any parameter will match nothing. Example: $m->replace($resource, NULL, $node, $replacement); Replaces all $node objects beeing subject or object in any triple of the model with the $replacement node. Throw an error in case of a paramter mismatch.
Saves the RDF,N3 or N-Triple serialization of the DbModel to a file.
You can decide to which format the model should be serialized by using a corresponding suffix-string as $type parameter. If no $type parameter is placed this method will serialize the model to XML/RDF format. Returns FALSE if the DbModel couldn't be saved to the file.
Set a base URI for the DbModel.
Affects creating of new resources and serialization syntax.
Return a new MemModel that is the subtraction of another model from this DbModel.
Short dump of the DbModel.
Dump of the DbModel including all triples.
Return a new MemModel that is the set-union the model with another model.
The result of taking the set-union of two or more RDF graphs (i.e. sets of triples) is another graph, which we will call the merge of the graphs. Each of the original graphs is a subgraph of the merged graph. Notice that when forming a merged graph, two occurrences of a given uriref or literal as nodes in two different graphs become a single node in the union graph (since by definition they are the same uriref or literal) but blank nodes are not 'merged' in this way; and arcs are of course never merged. In particular, this means that every blank node in a merged graph can be identified as coming from one particular graph in the original set of graphs.
Notice that one does not, in general, obtain the merge of a set of graphs by concatenating their corresponding N-triples documents and constructing the graph described by the merged document, since if some of the documents use the same node identifiers, the merged document will describe a graph in which some of the blank nodes have been 'accidentally' merged. To merge Ntriples documents it is necessary to check if the same nodeID is used in two or more documents, and to replace it with a distinct nodeID in each of them, before merging the documents. (Not implemented yet !!!!!!!!!!!)
Write the RDF serialization of the DbModel as HTML table.
Write the RDF serialization of the DbModel to string.
Inherited From Model
Model::Model()
Model::findForward()
Model::getBaseURI()
Model::getMemModelByRDQL()
Model::getOntModel()
Model::getResModel()
Model::load()
Model::sparqlPrepare()
Model::sparqlQuery()
Model::visualize()
Model::_parseSparqlQuery()
Model::_prepareSparql()
Inherited From Object
Object::toString()
Documentation generated on Fri, 1 Jun 2007 16:48:48 +0200 by phpDocumentor 1.3.2