RDF_Model_Memory (Constructor) [line 52]
RDF_Model_Memory RDF_Model_Memory(
[string
$baseURI = null])
|
|
You can supply a base_uri
Parameters:
add [line 112]
void add(
object Statement
$statement)
|
|
Adds a new triple to the Model_Memory without checking if the statement is already in the Model_Memory.
The function doesn't check if the statement is already in the Model_Memory. So if you want a duplicate free Model_Memory use the addWithoutDuplicates() function (which is slower then add())
Parameters:
addModel [line 897]
void addModel(
&$model, object Model
$model)
|
|
Adds another model to this Model_Memory.
Duplicate statements are not removed. If you don't want duplicates, use unite().
Parameters:
addWithoutDuplicates [line 132]
void addWithoutDuplicates(
object Statement
$statement)
|
|
Checks if a new statement is already in the Model_Memory and adds the statement, if it is not in the Model_Memory.
addWithoutDuplicates() is significantly slower then add().
Parameters:
close [line 963]
Close the Model_Memory and free up resources held.
contains [line 273]
boolean contains(
object Statement
&$statement)
|
|
Tests if the Model_Memory contains the given triple.
TRUE if the triple belongs to the Model_Memory; FALSE otherwise. To improve the search speed with big Model_Memorys, call index() before seaching.
Parameters:
containsAll [line 310]
boolean containsAll(
object Model
&$model)
|
|
Determine if all of the statements in a model are also contained in this Model_Memory.
True if all of the statements in $model are also contained in this Model_Memory and false otherwise.
Parameters:
containsAny [line 336]
boolean containsAny(
object Model
&$model)
|
|
Determine if any of the statements in a model are also contained in this Model_Memory.
True if any of the statements in $model are also contained in this Model_Memory and false otherwise.
Parameters:
equals [line 727]
boolean equals(
object model
&$that)
|
|
Checks 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.
Parameters:
find [line 413]
object Model_Memory find(
object Node
$subject, object Node
$predicate, object Node
$object)
|
|
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 Model_Memory if nothing is found. To improve the search speed with big Model_Memorys, call index() before seaching.
Parameters:
findCount [line 571]
integer findCount(
object Node
$subject, object Node
$predicate, object Node
$object)
|
|
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.
Parameters:
findFirstMatchingStatement [line 546]
object Statement findFirstMatchingStatement(
object Node
$subject, object Node
$predicate, object Node
$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 Model_Memory where the object equals $node. Returns an null if nothing is found.
Parameters:
findRegex [line 474]
object Model_Memory findRegex(
string
$subject_regex, string
$predicate_regex, string
$object_regex)
|
|
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 Model_Memory if nothing is found.
Parameters:
findVocabulary [line 511]
object Model_Memory findVocabulary(
string
$vocabulary)
|
|
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 Model_Memory if nothing is found.
Parameters:
getStatementIterator [line 953]
object StatementIterator &getStatementIterator(
)
|
|
Returns a StatementIterator for traversing the Model_Memory.
getUniqueResourceURI [line 690]
string getUniqueResourceURI(
string
$prefix)
|
|
Internal method, that returns a resource URI that is unique for the Model_Memory.
URIs are generated using the base_uri of the Model_Memory, the prefix and a unique number.
Parameters:
index [line 365]
Builds a search index for the statements in the Model_Memory.
The index is used by the find() and contains() 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.
intersect [line 854]
object Model_Memory &intersect(
&$model, object Model
$model)
|
|
Returns a new Model_Memory containing all the statements which are in both this Model_Memory and another.
Parameters:
isEmpty [line 94]
Checks if Model_Memory is empty
isIndexed [line 393]
Returns TRUE if the Model_Memory is indexed.
matchStatement [line 646]
boolean matchStatement(
object Statement
$statement, object Node
$subject, object Node
$predicate, object Node
$object)
|
|
Internal method that checks, if a statement matches a S, P, O or null combination.
null input for any parameter will match anything.
Parameters:
reify [line 933]
object Model_Memory &reify(
)
|
|
Reifies the Model_Memory.
Returns a new Model_Memory that contains the reifications of all statements of this Model_Memory.
remove [line 153]
void remove(
object Statement
$statement)
|
|
Removes the triple from the Model_Memory.
Parameters:
replace [line 594]
void replace(
object Node
$subject, object Node
$predicate, object Node
$object, object Node
$replacement)
|
|
General method to replace nodes of a Model_Memory.
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 Model_Memory with the $needle node.
Parameters:
saveAs [line 246]
boolean saveAs(
string
$filename, [string
$type = 'rdf'])
|
|
Saves the RDF,N3 or N-Triple serialization of the Model_Memory 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 Model_Memory couldn't be saved to the file.
Parameters:
setBaseURI [line 66]
void setBaseURI(
string
$uri)
|
|
Set a base URI for the Model_Memory.
Affects creating of new resources and serialization syntax. If the URI doesn't end with # : or /, then a # is added to the URI.
Parameters:
size [line 83]
Number of triples in the Model_Memory
subtract [line 815]
object Model_Memory &subtract(
&$model, object Model
$model)
|
|
Returns a new Model_Memory that is the subtraction of another model from this Model_Memory.
Parameters:
toString [line 175]
toStringIncludingTriples [line 186]
string toStringIncludingTriples(
)
|
|
Dumps of the Model_Memory including all triples.
unite [line 775]
object Model_Memory &unite(
&$model, object Model
$model)
|
|
Returns a new Model_Memory that is the set-union of the Model_Memory 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 !!!!!!!!!!!)
Parameters:
writeAsHtml [line 200]
Writes the RDF serialization of the Model_Memory as HTML.
writeAsHtmlTable [line 215]
Writes the RDF serialization of the Model_Memory as HTML table.
writeRDFToString [line 226]
string writeRDFToString(
)
|
|
Writes the RDF serialization of the Model_Memory as HTML table.