A MemModel is an RDF Model, which is stored in the main memory.
This class provides methods for manipulating MemModels.
Located in /model/MemModel.php (line 24)
Object | --Model | --MemModel
Class | Description |
---|---|
NamedGraphMem | NamedGraph implementation that extends a MemModel with a name. |
InfModel | A InfModel Model extends a MemModel , by adding the ability to infer statements from known statements and RDFS/OWL-Schematas. |
Constructor You can supply a base_uri
Adds a new triple to the MemModel without checking if the statement is already in the MemModel.
So if you want a duplicate free MemModel use the addWithoutDuplicates() function (which is slower then add())
Adds another model to this MemModel.
Duplicate statements are not removed. If you don't want duplicates, use unite(). 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 !!!!
Checks if a new statement is already in the MemModel and adds the statement, if it is not in the MemModel.
addWithoutDuplicates() is significantly slower then add(). Retruns TRUE if the statement is added. FALSE otherwise.
Tests if the MemModel contains the given triple.
TRUE if the triple belongs to the MemModel; FALSE otherwise.
Determine if all of the statements in a model are also contained in this MemModel.
True if all of the statements in $model are also contained in this MemModel and false otherwise.
Determine if any of the statements in a model are also contained in this MemModel.
True if any of the statements in $model are also contained in this MemModel and false otherwise.
Checks if two models are equal.
Two models are equal if and only if the two RDF graphs they represent are isomorphic.
General method to search for triples.
NULL input for any parameter will match anything. Example: $result = $m->find( NULL, NULL, $node ); Finds all triples with $node as object. Returns an empty MemModel if nothing is found.
Returns a FindIterator for traversing the MemModel.
Searches for triples and returns the number of matches.
NULL input for any parameter will match anything. Example: $result = $m->findCount( NULL, NULL, $node ); Finds all triples with $node as object.
Searches for triples and returns the first matching statement.
NULL input for any parameter will match anything. Example: $result = $m->findFirstMatchingStatement( NULL, NULL, $node ); Returns the first statement of the MemModel where the object equals $node. Returns an NULL if nothing is found. You can define an offset to search for. Default = 0
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. Returns an empty MemModel if nothing is found.
Returns 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# Returns an empty MemModel if nothing is found.
Returns the indextype: -1 if there is no index, 0 if there are indices over S,P,O(separate),
Returns a StatementIterator for traversing the MemModel.
Builds a search index for the statements in the MemModel.
The index is used by the find(),contains(),add() and remove() functions. Performance example using a model with 43000 statements on a Linux machine: Find without index takes 1.7 seconds. Indexing takes 1.8 seconds. Find with index takes 0.001 seconds. So if you want to query a model more then once, build a index first. The defaultindex is indices over subject, predicate, object seperate.
mode = 0 : indices over subject,predicate,object (default) mode = 1 : index over subject+predicate+object mode = 2 : index over subject+predicate mode = 3 : index over subject+object
Returns a new MemModel containing all the statements which are in both this MemModel and another.
Returns a FindIterator for traversing the MemModel.
Perform an RDQL query on this MemModel.
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 MemModel.
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.
Reifies the MemModel.
Returns a new MemModel that contains the reifications of all statements of this MemModel.
Removes the triple from the MemModel.
TRUE if the triple is removed. FALSE otherwise.
removes a single namespace from the model
General method to replace nodes of a MemModel.
NULL input for any parameter will match nothing. Example: $m->replace($node, NULL, $node, $replacement); Replaces all $node objects beeing subject or object in any triple of the MemModel with the $needle node.
Saves the RDF,N3 or N-Triple serialization of the MemModel 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 MemModel couldn't be saved to the file.
Set a base URI for the MemModel.
Affects creating of new resources and serialization syntax. If the URI doesn't end with # : or /, then a # is added to the URI.
Number of triples in the MemModel
Returns a new MemModel that is the subtraction of another model from this MemModel.
Short Dump of the MemModel.
Dumps of the MemModel including all triples.
Returns a new MemModel that is the set-union of the MemModel with another model.
Duplicate statements are removed. If you want to allow duplicates, use addModel() which is much faster.
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 !!!!!!!!!!!)
Writes the RDF serialization of the MemModel as HTML.
Writes the RDF serialization of the MemModel as HTML table.
Writes the RDF serialization of the MemModel as HTML table.
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:49:48 +0200 by phpDocumentor 1.3.2