4Suite™ API Documentation

# ► Module Ft.Rdf.Serializers.Dom

RDF model-to-DOM serialization, DOM-to-RDF model deserialization where the serialized DOM conforms to RDF/XML syntax (1999 Recommendation)
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: Serializer |  |  |  | Fields: CONTAINERS, DAML_OIL_NS, EMPTY_NAMESPACE, EMPTY_PREFIX, OBJECT_TYPE_LITERAL, OBJECT_TYPE_RESOURCE, OLD_DAML_OIL_NS, OWL_NS, RDF_MS_BASE, RDF_OBJ_PREDICATE, RDF_PREDICATES, RDF_PRED_PREDICATE, RDF_SCHEMA_BASE, RDF_SUBJ_PREDICATE, RDF_TYPE_PREDICATE, RDF_VALUE_PREDICATE, VALID_PARSETYPES, XMLNS_NAMESPACE, XML_NAMESPACE

## Classes

class Serializer
Serialize or deserialize a model based on the XML serialization in the RDF Model and Syntax recommendation.

### Methods

__init__(self, reify=1)
deserialize(self, model, node, scope=None)
Generate RDF statements from an XML serialization and insert these into a Model.
exportContainer(self, doc, parent, nsMap, type, stmts, id)
exportDescription(self, doc, nsMap, stmts, subject='', id='')
exportInlineResource(self, doc, nsMap, subject, origStmts)
exportSimpleStatements(self, doc, parent, nsMap, stmts)
isResource(self, res)
readBagIdAttr(self, node)
#6.9
readCollection(self, model, nodeList, scope, xmlBase, forceType=None)
#2.16
readContainer(self, model, node, scope)
#6.4
readDamlCollection(self, model, nodeList, scope, xmlBase, forceType=None)
readDescription(self, model, node, scope)
#6.3
readIdAboutAttr(self, scope, node)
#6.5, 6.6
readIdAttr(self, node)
#6.6
readMemberAttrs(self, node)
#6.31
readObject(self, model, node, scope)
#6.2
readParseType(self, node)
# 6.32, 6.33
readPropName(self, node)
#6.14
readPropertyAttrs(self, node)
#6.10
readPropertyElt(self, model, node, subjects, scope)
#6.12
readRdfKeyAttribute(self, node, local, defaultNsAllowed=1)
Returns None if the attribute is not on the element in null or RDF namespace, otherwise returns the attribute value Note that RDF M&S technically doesn't allow the qualified form, But user/implementor consensu allows this under the XML NS concept of global attrs
readResource(self, model, nodeList, scope, subjects=None)
#6.3
readResourceAttr(self, scope, node)
#6.18
readString(self, st)
#6.24
readTypeAttr(self, scope, node)
#6.11
readValue(self, model, node, scope, parseType, predicate, forceType=None)
#6.17
serialize(self, model, nsMap=None, selectUri=None, localResources=[], implementation=None, stmts=None)
Construct a DOM representing statements in the model.
splitUri(self, uri)
If there's a fragment, returns (base+'#', fragment); otherwise returns ('', uri)
uriFromParts(self, baseUri, part1, part2)
From RDF-MS, part 6:
'...the expansion of the namespace-qualified tag name
(Generic Identifier) of E. This expansion is generated by
concatenating the namespace name given in the namespace
declaration with the LocalPart of the qualified name.'
...
'URI-References are resolved to resource identifiers by first
resolving the URI-reference to absolute form as specified by
[RFC 2396] using the base URI of the document in which the RDF
statements appear.'
validateIdSymbol(self, idSym)
validateString(self, st)
validateUriReference(self, ref)

## Fields

CONTAINERS = ['Bag', 'Seq', 'Alt']
DAML_OIL_NS = 'http://www.w3.org/2001/10/daml+oil#'
EMPTY_NAMESPACE = None
EMPTY_PREFIX = None
OBJECT_TYPE_LITERAL = 'L'
OBJECT_TYPE_RESOURCE = 'R'
OLD_DAML_OIL_NS = 'http://www.daml.org/2001/03/daml+oil#'
OWL_NS = 'http://www.w3.org/2002/07/owl#'
RDF_MS_BASE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
RDF_OBJ_PREDICATE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object'
RDF_PREDICATES = ['http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value']
RDF_PRED_PREDICATE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate'
RDF_SCHEMA_BASE = 'http://www.w3.org/2000/01/rdf-schema#'
RDF_SUBJ_PREDICATE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#subject'
RDF_TYPE_PREDICATE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
RDF_VALUE_PREDICATE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value'
VALID_PARSETYPES = [(None, u'Literal'), (None, u'Resource'), ('http://www.w3.org/2001/10/daml+oil#', u'collection'), ('http://www.daml.org/2001/03/daml+oil#', u'collection'), (None, u'Collection')]
XMLNS_NAMESPACE = u'http://www.w3.org/2000/xmlns/'
XML_NAMESPACE = u'http://www.w3.org/XML/1998/namespace'