4Suite™ API Documentation

# ► Module Ft.Server.Server.Xslt.Model

XSLT and XPath extensions supporting the 4Suite RDF API
Copyright 2004 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes:
DeserializeAndAddElement, DeserializeAndRemoveElement, RdfAddElement, RdfBaseElement, RdfCompleteElement, RdfPatternBaseElement, RdfRemoveElement, RdfVersaAssignElement, RdfVersaQueryElement, RdfVisualizeElement

Functions:
RdfAny, RdfComplete, RdfContains, RdfVersaQueryFunction, WriteVersaResults

Fields:
CONTAINERS, DOCUMENT_DEFINITIONS, DUMMY_MODEL, ExtElements, ExtFunctions, OBJECT_TYPE_LITERAL, OBJECT_TYPE_RESOURCE, OBJECT_TYPE_UNKNOWN, OBJ_TYPE_LOOKUP, RAW_FILES, RDF_NS, RESERVED_NAMESPACE, RESOURCE_CACHE, RESOURCE_CONTENT, RESOURCE_METADATA, SESSION_DATA, VB_PARAM, XML_DOCUMENTS, g_resourceTypeMap

## Classes

class DeserializeAndAddElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)
Deserializes an RDF document into statements, and adds them to a scope
The content of the frdf:deserialize-and-add element is a template for the
RDF/XML source from which the statements are parsed.

### Methods

instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
Template is the set of text, instructions or result-elements
legalAttrs = {'base-path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>}

### Fields

class DeserializeAndRemoveElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)
Deserializes an RDF document into statements, and removes any statements in the given scope with matching triple values.
The content of the frdf:deserialize-and-remove element is a template for
the RDF/XML source from which the statements are parsed.

### Methods

instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
Template is the set of text, instructions or result-elements
legalAttrs = {'base-path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>}

### Fields

class RdfAddElement(RdfBaseElement)
Adds statements to the repository model. The subject, predicates and objects can be strings or node sets node sets are converted to a list of strings by taking the string value of each item. String values are treated a list with one string. The cartesian product of statements that come from the list of subject, predicate and object strings are all added to the model using the given scope and statement URI.

### Methods

instantiate(self, context, processor)

### Methods inherited from class RdfBaseElement

getStatementInfo

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

class RdfBaseElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)

### Methods

getStatementInfo(self, context)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, instantiate, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Atom instance>
Empty is the content model for childless elements
legalAttrs = {'o': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'p': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 's': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'scope': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>, 'stmt-uri': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>, 'type': <Ft.Xml.Xslt.AttributeInfo.Expression instance>}

### Fields

class RdfCompleteElement(RdfPatternBaseElement)

### Methods

instantiate(self, context, processor)

### Methods inherited from class RdfPatternBaseElement

getRdfPatternCriteria

### Methods inherited from class RdfBaseElement

getStatementInfo

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

class RdfPatternBaseElement(RdfBaseElement)

### Methods

getRdfPatternCriteria(self, context)

### Methods inherited from class RdfBaseElement

getStatementInfo

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, instantiate, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

legalAttrs = {'o': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'o-flags': <Ft.Xml.Xslt.AttributeInfo.ChoiceAvt instance>, 'p': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'p-flags': <Ft.Xml.Xslt.AttributeInfo.ChoiceAvt instance>, 's': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 's-flags': <Ft.Xml.Xslt.AttributeInfo.ChoiceAvt instance>, 'scope': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>, 'scope-flags': <Ft.Xml.Xslt.AttributeInfo.ChoiceAvt instance>, 'stmt-uri': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>, 'stmt-uri-flags': <Ft.Xml.Xslt.AttributeInfo.ChoiceAvt instance>, ...}

### Fields

class RdfRemoveElement(RdfPatternBaseElement)
Removes statements to the repository model. The subject, predicates and objects can be strings or node sets node sets are converted to a list of strings by taking the string value of each item. String values are treated a list with one string. The cartesian product of statements that come from the list of subject, predicate and object strings and that match the given scope and statement URI are all removed from the model.

### Methods

instantiate(self, context, processor)

### Methods inherited from class RdfPatternBaseElement

getRdfPatternCriteria

### Methods inherited from class RdfBaseElement

getStatementInfo

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

class RdfVersaAssignElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)
Execute a Versa query and assign the result to a Versa variable, for use in further queries. The variable becomes bound in the Versa context for the current stylesheet invokation, and thus will be defined on all Versa queries performed subsequently, through <frdf:versa-query> or <frdf:versa-assign>.
The content of the frdf:versa-assign element is a template for the
extra namespace mappings for the query (see /ftss/dashboard/NsMappings.xml
for an example of the xml format).
For example, if you have the following:
<frdf:versa-assign query="type(rdfs:Class)" name="classes"/>
You can later execute
<frdf:versa-query query="$classes - rdfs:label -> *"/>

### Methods

instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
Template is the set of text, instructions or result-elements
legalAttrs = {'name': <Ft.Xml.Xslt.AttributeInfo.QNameAvt instance>, 'query': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'scope': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>}

### Fields

class RdfVersaQueryElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)
Execute a Versa query and put the results in serialized XML form to the XSLT processor output.
The content of the frdf:versa-query element is a template for the
extra namespace mappings for the query (see /ftss/dashboard/NsMappings.xml
for an example of the xml format).
The form of the Versa output is as documented in
http://rdfinference.org/versa-xml.

### Methods

instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
Template is the set of text, instructions or result-elements
legalAttrs = {'query': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'scope': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>}

### Fields

class RdfVisualizeElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)
This extension element uses GraphViz to generate a diagram of a given resource, a set of resources in a particular scope, or of the entire system model. It adds an HTML imagemap (a chunk of text that can be placed in a MAP element) to the result tree, and has the side effect of generating in the repository an SVG or JPEG image resource representing the corresponding diagram.
output-path specifies the repo path of the diagram to generate. If the
resource exists already, its content will be overwritten.
If provided, resourcePath must to refer to either a specific resource in
the system model or an RDF document in the repository. If it refers to an
RDF document, then all RDF statements with that document's URI as their
scope will be graphed. If the resourcePath refers to any other kind of
resource, then only statements about it will be graphed. If no
resourcePath is specified, then the entire system model will be graphed.
The image map text placed in the result tree uses the uriFormat string
to generate (by appying the uris of all resources against this string)
the links for all resources in the image. imagemap information is
generated and returned only if the uriFormat string is specified.
Most RDF graphs are width heavy and the visualizer can be told to rotate
the image 90 degrees which can be helpful far larger graphs (which could
great widths). This is specified by the rotate attribute. If present,
the graph is rotated, otherwise it isn't.
The max-arcs attribute specifies the maximum number of arcs. If the graph
requires more arcs, then nothing will be generated at all.
This element can also take a versa query result as its child nodes. In
this case, all the resources in the result are graphed and resource-path
is ignored.

### Methods

instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
Template is the set of text, instructions or result-elements
legalAttrs = {'graph-vis': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'map-name': <Ft.Xml.Xslt.AttributeInfo.IdAvt instance>, 'max-arcs': <Ft.Xml.Xslt.AttributeInfo.NumberAvt instance>, 'namespaces': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'output-path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'resourcePath': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'rotate': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'scoped': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'svg': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'uri-format': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>}

### Fields

## Functions

RdfAny(context)
RdfComplete(context, subj, pred, obj=None)
Runs a complete on the repository model, which matches patterns among the triples in the model. You provide whichever of the subject, predicate and object you'd like to match, and use the frdf:any() function as a wildcard. The return value is a generated node set which has one or more "Statement" elements, each with 5 children: "Subject", "Predicate", "Object", "StatementUri", "Scope" which represent the respective components of the RDF statement.
for example:
frdf:complete("http://spam.com", frdf:any(), frdf:any())
would return all statements with "http://spam.com" as the subjects.
RdfContains(context, subj, pred, obj=None)
Runs a conatins on the repository model, which matches patterns among the triples in the model. You provide whichever of the subject, predicate and object you'd like to match, and use the frdf:any() function as a wildcard. The return value is a boolean indicating whether or not a matching statement exists.
RdfVersaQueryFunction(context, query, scope=None)
Perform a Versa Query as a function, return a node-set representing the outside list.
WriteVersaResults(processor, results)

## Fields

CONTAINERS = [1]
DOCUMENT_DEFINITIONS = [9, 11]
DUMMY_MODEL = <RDF Resource at 22703568: [URI: ]>
ExtElements = {('http://xmlns.4suite.org/4ss/rdf', 'add'): <class Ft.Server.Server.Xslt.Model.RdfAddElement>, ('http://xmlns.4suite.org/4ss/rdf', 'complete'): <class Ft.Server.Server.Xslt.Model.RdfCompleteElement>, ('http://xmlns.4suite.org/4ss/rdf', 'deserialize-and-add'): <class Ft.Server.Server.Xslt.Model.DeserializeAndAddElement>, ('http://xmlns.4suite.org/4ss/rdf', 'deserialize-and-remove'): <class Ft.Server.Server.Xslt.Model.DeserializeAndRemoveElement>, ('http://xmlns.4suite.org/4ss/rdf', 'remove'): <class Ft.Server.Server.Xslt.Model.RdfRemoveElement>, ('http://xmlns.4suite.org/4ss/rdf', 'versa-assign'): <class Ft.Server.Server.Xslt.Model.RdfVersaAssignElement>, ('http://xmlns.4suite.org/4ss/rdf', 'versa-query'): <class Ft.Server.Server.Xslt.Model.RdfVersaQueryElement>, ('http://xmlns.4suite.org/4ss/rdf', 'visualize'): <class Ft.Server.Server.Xslt.Model.RdfVisualizeElement>}
ExtFunctions = {('http://xmlns.4suite.org/4ss/rdf', 'any'): <function RdfAny>, ('http://xmlns.4suite.org/4ss/rdf', 'complete'): <function RdfComplete>, ('http://xmlns.4suite.org/4ss/rdf', 'contains'): <function RdfContains>, ('http://xmlns.4suite.org/4ss/rdf', 'versa-query'): <function RdfVersaQueryFunction>}
OBJECT_TYPE_LITERAL = 'L'
OBJECT_TYPE_RESOURCE = 'R'
OBJECT_TYPE_UNKNOWN = '?'
OBJ_TYPE_LOOKUP = {'LITERAL': 'L', 'RESOURCE': 'R'}
RAW_FILES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15, 17]
RDF_NS = 'http://xmlns.4suite.org/4ss/rdf'
RESERVED_NAMESPACE = 'http://xmlns.4suite.org/reserved'
RESOURCE_CACHE = 3
RESOURCE_CONTENT = 2
RESOURCE_METADATA = 1
SESSION_DATA = 4
VB_PARAM = ('http://xmlns.4suite.org/reserved', 'versa-variable-bindings')
XML_DOCUMENTS = [1, 2, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15]
g_resourceTypeMap = {0: 'Unknown Resource', 1: 'Container', 2: 'Alias', 3: 'Raw File', 4: 'XML Document', 5: 'XSLT Document', 6: 'Schematron Document', 7: 'User', 8: 'Group', 9: 'XPath Document Definition', ...}