4Suite™ API Documentation

# ► Module Ft.Rdf.Serializers.NTriples

N-Triples module. http://www.w3.org/TR/rdf-testcases/#ntriples
Copyright 2003 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: Literal, Resource, Serializer |  |  |  | Functions: ParseNTriples, Test |  |  |  | Fields: CHAR, DTSTRING, DTSTRING_REGEX, LANG, LANGSTRING, LANGSTRING_REGEX, NAME, NODEID, NODEID_REGEX, OBJECT_TYPE_LITERAL, OBJECT_TYPE_RESOURCE, OBJECT_TYPE_UNKNOWN, RDF_MS_BASE, RDF_SCHEMA_BASE, URIREF, URIREF_REGEX, URI_REGEX

## Classes

class Literal

### Methods

__init__(self, value, datatype='http://www.w3.org/2000/01/rdf-schema#Literal')
__repr__(self)
__str__ = __repr__(self)

class Resource

### Methods

__init__(self, id, anon=0)
__repr__(self)
__str__ = __repr__(self)

class Serializer
Serialize or deserialize a model using N-Triples.

### Methods

__init__(self, reify=1)
deserialize(self, model, stream, scope=None)
serialize(self, model, nsMap=None, selectUri=None, localResources=[], stmts=None, stream=None)
Construct a DOM representing statements in the model.

## Functions

ParseNTriples(lines)
Takes a sequence of lines with NTriples and returns a list of resulting statement objects
Test()

## Fields

CHAR = '[ -x7E]'
DTSTRING = <_sre.SRE_Pattern object>
Compiled regular expression objects
DTSTRING_REGEX = '"(?P<name>[ -x7E]*)"^^(?P<dt>(?:(?:[a-zA-Z][0-9a...\\.]*:)?/{0,2}[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*\'()%]+)?)'
LANG = r'[a-z0-9]+(\-[a-z0-9]+)?'
LANGSTRING = <_sre.SRE_Pattern object>
Compiled regular expression objects
LANGSTRING_REGEX = r'"(?P<value>[ -x7E]*)"(@(?P<lang>[a-z0-9]+(\-[a-z0-9]+)?))?'
NAME = '[A-Za-z][A-Za-z0-9]*'
NODEID = <_sre.SRE_Pattern object>
Compiled regular expression objects
NODEID_REGEX = '_:(?P<name>[A-Za-z][A-Za-z0-9]*)'
OBJECT_TYPE_LITERAL = 'L'
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#'
URIREF = <_sre.SRE_Pattern object>
Compiled regular expression objects
URIREF_REGEX = r"<(?P<uriref>(?:(?:[a-zA-Z][0-9a-zA-Z+\-\.]*:)?/{0,2}[0-9a-zA-Z;/?:@&=+$\.\-_!~*'()%]+)?)>"
URI_REGEX = r"(?:(?:[a-zA-Z][0-9a-zA-Z+\-\.]*:)?/{0,2}[0-9a-zA-Z;/?:@&=+$\.\-_!~*'()%]+)?"