Class Model

Description

Abstract superclass of MemModel and DbModel. A model is a programming interface to an RDF graph.

An RDF graph is a directed labeled graph, as described in http://www.w3.org/TR/rdf-mt/. It can be defined as a set of <S, P, O> triples, where P is a uriref, S is either a uriref or a blank node, and O is either a uriref, a blank node, or a literal.



History:

Located in /model/Model.php (line 37)

Object
   |
   --Model
Direct descendents
Class Description
DbModel This class provides methods for manipulating DbModels from DbStore.
MemModel A MemModel is an RDF Model, which is stored in the main memory.
Method Summary
Model Model ()
object MemModel findForward (object Node $subject, object Node $predicate, object MemModel $object, [mixed $newModel = NULL])
string getBaseURI ()
object MemModel &getMemModelByRDQL (string $queryString, [boolean $closure = FALSE])
object OntModel &getOntModel (constant $vocabulary)
object MemModel &getResmodel (constant $modelType, string $baseURI)
void load (string $filename, [string $type = NULL], [boolean $stream = false])
String/array sparqlQuery (String $query, [String $resultform = false])
string, visualize ([string $format = "dot"], [boolean $short_prefix = TRUE])
Methods
Constructor Model (line 66)

Notice for people who are used to work with older versions of RAP.

  • access: public
  • throws: PHPError
Model Model ()
findForward (line 268)

Searches for triples using find() and tracks forward blank nodes until the final objects in the retrieved subgraphs are all named resources.

The method calls itself recursivly until the result is complete. NULL input for subject, predicate or object will match anything. Inputparameters are ignored for recursivly found statements. Returns a new MemModel or adds (without checking for duplicates) the found statements to a given MemModel. Returns an empty MemModel, if nothing is found. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING: This method can be slow with large models. NOTE: Blank nodes are not renamed, they keep the same nodeIDs as in the queried model! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

object MemModel findForward (object Node $subject, object Node $predicate, object MemModel $object, [mixed $newModel = NULL])
getBaseURI (line 81)

Return current baseURI.

  • access: public
string getBaseURI ()
getMemModelByRDQL (line 322)

Perform an RDQL query on this Model. Should work with all types of models.

This method returns a MemModel containing the result statements. If $closure is set to TRUE, the result will additionally contain statements found by the findForward-method for blank nodes. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING: If called with $closure = TRUE this method can be slow with large models. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • access: public
  • author: Anton Köstlbacher <anton1@koestlbacher.de>
  • author: code snippets taken from the RAP Netapi by Phil Dawes and Chris Bizer
object MemModel &getMemModelByRDQL (string $queryString, [boolean $closure = FALSE])
  • string $queryString
  • boolean $closure
getOntModel (line 235)

Returns an OntModel with this model as baseModel.

$vocabulary has to be one of the following constants (currently only one is supported): RDFS_VOCABULARY to select a RDFS Vocabulary. You can supply a base URI

  • access: public
object OntModel &getOntModel (constant $vocabulary)
  • constant $vocabulary
getResmodel (line 219)

Returns a ResModel with this model as baseModel.

  • access: public
object MemModel &getResmodel (constant $modelType, string $baseURI)
  • constant $modelType
  • string $baseURI
load (line 98)

Load a model from a file containing RDF, N3, N-Triples or a xhtml document containing RDF.

This function recognizes the suffix of the filename (.n3 or .rdf) and calls a suitable parser, if no $type is given as string ("rdf" "n3" "nt"); If the model is not empty, the contents of the file is added to this DbModel.

  • access: public
void load (string $filename, [string $type = NULL], [boolean $stream = false])
  • string $filename
  • string $type
  • boolean $stream

Redefined in descendants as:
sparqlQuery (line 451)

Performs a SPARQL query against a model. The model is converted to an RDF Dataset. The result can be retrived in SPARQL Query Results XML Format or as an array containing the variables an their bindings.

String/array sparqlQuery (String $query, [String $resultform = false])
  • String $query: the sparql query string
  • String $resultform: the result form (''xml'' for SPARQL Query Results XML Format)
visualize (line 437)

Alias for RDFUtil::visualiseGraph(&$model, $format, $short_prefix)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Note: See RDFUtil for further Information. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

string, visualize ([string $format = "dot"], [boolean $short_prefix = TRUE])
  • string $format
  • boolean $short_prefix

Inherited Methods

Inherited From Object

Object::toString()

Documentation generated on Fri, 13 Jan 2006 07:48:36 +0100 by phpDocumentor 1.3.0RC4