turtle
Turtle RDF graph serializer for RDFLib. See http://www.w3.org/TeamSubmission/turtle/ for syntax specification.
Classes:
-
RecursiveSerializer–Base class for recursive serializers.
-
TurtleSerializer–Turtle RDF graph serializer.
RecursiveSerializer
RecursiveSerializer(store: Graph)
Bases: Serializer
Base class for recursive serializers.
Methods:
-
addNamespace– -
buildPredicateHash–Build a hash key by predicate to a list of objects for the given
-
checkSubject–Check to see if the subject should be serialized yet
-
indent–Returns indent string multiplied by the depth
-
isDone–Return true if subject is serialized
-
orderSubjects– -
preprocess– -
preprocessTriple– -
relativize– -
reset– -
sortProperties–Take a hash from predicate uris to lists of values.
-
subjectDone–Mark a subject as done.
-
write–Write text in given encoding.
Attributes:
-
indentString– -
maxDepth– -
predicateOrder– -
roundtrip_prefixes(Tuple[Any, ...]) – -
stream(Optional[IO[bytes]]) – -
topClasses–
Source code in rdflib/plugins/serializers/turtle.py
addNamespace
addNamespace(prefix: str, uri: URIRef) -> None
Source code in rdflib/plugins/serializers/turtle.py
buildPredicateHash
buildPredicateHash(subject: _SubjectType) -> Mapping[_PredicateType, List[Node]]
Build a hash key by predicate to a list of objects for the given subject
Source code in rdflib/plugins/serializers/turtle.py
checkSubject
Check to see if the subject should be serialized yet
Source code in rdflib/plugins/serializers/turtle.py
indent
isDone
orderSubjects
Source code in rdflib/plugins/serializers/turtle.py
preprocess
preprocessTriple
relativize
relativize(uri: _StrT) -> Union[_StrT, URIRef]
Source code in rdflib/plugins/serializers/turtle.py
reset
Source code in rdflib/plugins/serializers/turtle.py
sortProperties
sortProperties(properties: Mapping[_PredicateType, List[Node]]) -> List[_PredicateType]
Take a hash from predicate uris to lists of values. Sort the lists of values. Return a sorted list of properties.
Source code in rdflib/plugins/serializers/turtle.py
subjectDone
write
Write text in given encoding.
TurtleSerializer
TurtleSerializer(store: Graph)
Bases: RecursiveSerializer
Turtle RDF graph serializer.
Methods:
-
addNamespace– -
doList– -
endDocument– -
getQName– -
isValidList–Checks if l is a valid RDF list, i.e. no nodes have other properties.
-
label– -
objectList– -
p_default– -
p_squared– -
path– -
predicateList– -
preprocessTriple– -
reset– -
s_default– -
s_squared– -
serialize– -
startDocument– -
statement– -
verb–
Attributes:
-
indentString– -
keywords(Dict[Node, str]) – -
short_name– -
stream–
Source code in rdflib/plugins/serializers/turtle.py
addNamespace
addNamespace(prefix: str, namespace: URIRef) -> str
Source code in rdflib/plugins/serializers/turtle.py
doList
doList(l_: Node) -> None
Source code in rdflib/plugins/serializers/turtle.py
endDocument
getQName
getQName(uri: Node, gen_prefix: bool = True) -> Optional[str]
Source code in rdflib/plugins/serializers/turtle.py
isValidList
isValidList(l_: Node) -> bool
Checks if l is a valid RDF list, i.e. no nodes have other properties.
Source code in rdflib/plugins/serializers/turtle.py
label
label(node: Node, position: int) -> str
Source code in rdflib/plugins/serializers/turtle.py
objectList
objectList(objects: Sequence[Node]) -> None
Source code in rdflib/plugins/serializers/turtle.py
p_default
p_default(node: Node, position: int, newline: bool = False) -> bool
p_squared
p_squared(node: Node, position: int, newline: bool = False) -> bool
Source code in rdflib/plugins/serializers/turtle.py
path
path(node: Node, position: int, newline: bool = False) -> None
predicateList
predicateList(subject: Node, newline: bool = False) -> None
Source code in rdflib/plugins/serializers/turtle.py
preprocessTriple
Source code in rdflib/plugins/serializers/turtle.py
reset
s_default
s_squared
Source code in rdflib/plugins/serializers/turtle.py
serialize
serialize(stream: IO[bytes], base: Optional[str] = None, encoding: Optional[str] = None, spacious: Optional[bool] = None, **kwargs: Any) -> None