4Suite™ API Documentation

# ► Module Ft.Rdf.Parsers.Versa.ResourceExpressions

Implementation and utilities for resource processing Versa
Copyright 2003 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: CurrentExpression, LiteralExpression, PureQNameExpression, ResourceExpression |  |  |  | Functions: GetRelations, TCTest, TransitiveClosure |  |  |  | Fields: OBJECT_TYPE_RESOURCE, OBJECT_TYPE_UNKNOWN, RDF_MS_BASE, RDF_SCHEMA_BASE

## Classes

class CurrentExpression(ResourceExpression)
Return the current resource if there is one

### Methods

evaluate(self, con)

class LiteralExpression(ResourceExpression)
Use the resource as is

### Methods

__init__(self, value)
evaluate(self, con)

class PureQNameExpression(ResourceExpression)
Expand a QName into a string. Uses the NsMapping on the context

### Methods

__init__(self, expr)
evaluate(self, con)

class ResourceExpression
Base class for all resource expressions

## Functions

GetRelations(start, property, con, inverse, useSubProps=1, forceTransitive=0)
Returns a dictionary of dictionaries. The outer dict maps properties to relations. The relation dicts match subjects to objects for each property.
TCTest()
TransitiveClosure(edge_dict)
edge_dict expresses connectedness in the form: { a: [b, f, g], c: [a], d: [f], e: [d], f: [e], g: [c, j], h: [g, i], i: [h], j: [k, l, m], l: [g, m], m: [l] } Return value is new dict f the same form, but transitivly closed

## Fields

OBJECT_TYPE_RESOURCE = 'R'
OBJECT_TYPE_UNKNOWN = '?'
RDF_MS_BASE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
RDF_SCHEMA_BASE = 'http://www.w3.org/2000/01/rdf-schema#'