4Suite™ API Documentation

# ► Module Ft.Rdf.Model

The model container for RDF meta-data: represents a directed graph
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: Model |  |  |  | Fields: IGNORE_CASE, NORMAL, REGEX

## Classes

class Model(Ft.Rdf.Resource.Resource)
Represents a universe of RDF statements, which at the abstract level represents a set of graphs that make up an RDF model

### Methods

__init__(self, driver, schemaHandler=None, baseUri='')
Initializer for an RDF model instance. driver is an intance of the driver used to store the statements. schemaHandler is a reference to an object that can be used to govern operations on the model, as typically formalized in a schema language such as RDFS or DAML. This object can be None, disabling all such specialized processing.
add(self, statements)
Add statement(s) to the model
addContainer(self, container, scope=None)
Add a container to the model. This involves adding a statement for the container type, and a container statement for each item in the collection.
bind(self, object, name, scope=None)
Bind a Compiled Inference Object to a specific name in the Model
checkConsistency(self)
Check the consistency of the entire model
compileRil(self, expression)
Compile a Ril expression into a compiled object
complete(self, subject, predicate, object, statementUri=None, scope=None, **flags)
Return all the statements in the model that match the given pattern.
Any combination of s, p and o can be None, and any None slot is
treated as a wildcard that matches any value in the model. A list
is returned comprising all the statement objects that match the
arguments.
flags keyword arguments map to the listed arguments with 'Flags'
append to the name. Where the value is any combination of
IGNORE_CASE and REGEX.
http://www.w3.org/TR/rdf-mt/#RDFRules [7.3 RDFS Entailment Rules]
An RDFS entailment rule (rdfs7) can be applied to 'enhance' and/or optimize this calculation
contains(self, statement)
Check if a statement is in the model
containsPattern(self, subject, predicate, object, statementUri=None, scope=None, **flags)
Determine if any statement matching the given criteria is in the model. See complete() for a description of the flags keyword argument.
exclude(self, subject, predicate, object, statementUri=None, scope=None, **flags)
Return all the statements in the model that DO NOT match the given pattern.
See complete() for a description of the flags keyword argument.
extractContainer(self, uri, scope=None)
Build a container object from the container item relationships in the model (_1, _2, etc.).
generateBnode(self)
Generates blank nodes (bnodes), AKA anonymous resources
generateUri(self)
Generates URIs on the fly, e.g. for reified statements. Do *not* use this to generate anonymous resources. Use generateBnode instead The default method is to generate a UUID URN, but this can be easily overridden.
has_key(self, name, scope=None)
See if the specified name is bound to the model
isBnodeLabel(self, label)
Determines whether a label is a blank node
keys(self, scope=None)
Get a list of bound names in the model
lookup(self, name, scope=None)
Retrieve a previously bound Inference Object from the model
remove(self, statements)
Remove statement(s) from the model.
removePattern(self, subject, predicate, object, statementUri=None, scope=None, **flags)
Remove all statements from the model that match the specified pattern. See complete() for a description of the flags keyword argument.
resumeSchema(self)
setSchemaActivity(self, value)
size(self, scope=None)
Returns the number of statements in the model
statements(self, scope=None)
Returns all the statments in the model.
suspendSchema(self)
unbind(self, name, scope=None)
Remove a binding from the model

### Methods inherited from class Ft.Rdf.Resource.Resource

__repr__, isAnonymous, isBnode

## Fields

IGNORE_CASE = 1
NORMAL = 0
REGEX = 2