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:
Functions:
Fields:

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

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

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

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

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

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

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

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

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

Fields

Fields

Fields


Methods

getStatementInfo(self, context)

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

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

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

Fields


class RdfCompleteElement(RdfPatternBaseElement)

Methods

instantiate(self, context, processor)

Methods inherited from class RdfPatternBaseElement

Methods inherited from class RdfBaseElement

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

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

Fields

Fields

Fields

Fields


class RdfPatternBaseElement(RdfBaseElement)

Methods

getRdfPatternCriteria(self, context)

Methods inherited from class RdfBaseElement

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

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

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

Fields

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

Methods inherited from class RdfBaseElement

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

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

Fields

Fields

Fields

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

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

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

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

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

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

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

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

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

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

DUMMY_MODEL = <RDF Resource at 25077232: [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>}
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'
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', ...}