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/


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


__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)
readCollection(self, model, nodeList, scope, xmlBase, forceType=None)
readContainer(self, model, node, scope)
readDamlCollection(self, model, nodeList, scope, xmlBase, forceType=None)
readDescription(self, model, node, scope)
readIdAboutAttr(self, scope, node)
#6.5, 6.6
readIdAttr(self, node)
readMemberAttrs(self, node)
readObject(self, model, node, scope)
readParseType(self, node)
# 6.32, 6.33
readPropName(self, node)
readPropertyAttrs(self, node)
readPropertyElt(self, model, node, subjects, scope)
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)
readResourceAttr(self, scope, node)
readString(self, st)
readTypeAttr(self, scope, node)
readValue(self, model, node, scope, parseType, predicate, forceType=None)
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)


CONTAINERS = ['Bag', 'Seq', 'Alt']
DAML_OIL_NS = 'http://www.w3.org/2001/10/daml+oil#'
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'