2005-04-06 23:05:46

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/

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.

Template is the set of text, instructions or result-elements

<Ft.Xml.Xslt.ContentInfo.Rep instance>
{'base-path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>}

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.

Template is the set of text, instructions or result-elements

<Ft.Xml.Xslt.ContentInfo.Rep instance>
{'base-path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'path': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>}

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.

Empty is the content model for childless elements

<Ft.Xml.Xslt.ContentInfo.Atom instance>
{'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>}

{'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>, ...}

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.

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 -> *"/>

Template is the set of text, instructions or result-elements

<Ft.Xml.Xslt.ContentInfo.Rep instance>
{'name': <Ft.Xml.Xslt.AttributeInfo.QNameAvt instance>, 'query': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'scope': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>}

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.

Template is the set of text, instructions or result-elements

<Ft.Xml.Xslt.ContentInfo.Rep instance>
{'query': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'scope': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>}

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.

Template is the set of text, instructions or result-elements

<Ft.Xml.Xslt.ContentInfo.Rep instance>
{'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>}

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.

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.

Perform a Versa Query as a function, return a node-set representing the outside list.

Use a DOM writer to serialize a given list of statements as returned from a complete. Used by various functions in this module.

[1]
[9, 11]
<RDF Resource at 1227264364: [URI: ]>
{('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>}
{('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>}
'L'
'R'
'?'
{'LITERAL': 'L', 'RESOURCE': 'R'}
[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15, 17]
'http://xmlns.4suite.org/4ss/rdf'
'http://xmlns.4suite.org/reserved'
3
2
1
4
('http://xmlns.4suite.org/reserved', 'versa-variable-bindings')
[1, 2, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15]
{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', ...}