# serializers Package

## `n3` Module

Notation 3 (N3) RDF graph serializer for RDFLib.

class `rdflib.plugins.serializers.n3.``N3Serializer`(store, parent=None)

  Bases: `rdflib.plugins.serializers.turtle.TurtleSerializer`

  `__init__`(store, parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.n3'
  `endDocument`()
  `getQName`(uri, gen_prefix=True)
  `indent`(modifier=0)

    Returns indent string multiplied by the depth

  `isDone`(subject)

    Return true if subject is serialized

  `p_clause`(node, position)
  `path`(node, position, newline=False)
  `preprocessTriple`(triple)
  `reset`()
  `s_clause`(subject)
  `short_name` = 'n3'
  `startDocument`()
  `statement`(subject)
  `subjectDone`(subject)

    Mark a subject as done.

## `nquads` Module

class `rdflib.plugins.serializers.nquads.``NQuadsSerializer`(store)

  Bases: `rdflib.serializer.Serializer`

  `__init__`(store)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.nquads'
  `serialize`(stream, base=None, encoding=None, **args)

    Abstract method

## `nt` Module

N-Triples RDF graph serializer for RDFLib. See <http://www.w3.org/TR/rdf-testcases/#ntriples> for details about the format.

class `rdflib.plugins.serializers.nt.``NTSerializer`(store)

  Bases: `rdflib.serializer.Serializer`

  Serializes RDF graphs to NTriples format.

  `__init__`(store)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.nt'
  `serialize`(stream, base=None, encoding=None, **args)

    Abstract method

## `rdfxml` Module

`rdflib.plugins.serializers.rdfxml.``fix`(val)

  strip off _: from nodeIDs… as they are not valid NCNames

class `rdflib.plugins.serializers.rdfxml.``XMLSerializer`(store)

  Bases: `rdflib.serializer.Serializer`

  `__init__`(store)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.rdfxml'
  `predicate`(predicate, object, depth=1)
  `serialize`(stream, base=None, encoding=None, **args)

    Abstract method

  `subject`(subject, depth=1)

class `rdflib.plugins.serializers.rdfxml.``PrettyXMLSerializer`(store, max_depth=3)

  Bases: `rdflib.serializer.Serializer`

  `__init__`(store, max_depth=3)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.rdfxml'
  `predicate`(predicate, object, depth=1)
  `serialize`(stream, base=None, encoding=None, **args)

    Abstract method

  `subject`(subject, depth=1)

## `trig` Module

Trig RDF graph serializer for RDFLib. See <http://www.w3.org/TR/trig/> for syntax specification.

class `rdflib.plugins.serializers.trig.``TrigSerializer`(store)

  Bases: `rdflib.plugins.serializers.turtle.TurtleSerializer`

  `__init__`(store)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.trig'
  `indentString` = ' '
  `preprocess`()
  `reset`()
  `serialize`(stream, base=None, encoding=None, spacious=None, **args)

    Abstract method

  `short_name` = 'trig'

## `trix` Module

class `rdflib.plugins.serializers.trix.``TriXSerializer`(store)

  Bases: `rdflib.serializer.Serializer`

  `__init__`(store)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.trix'
  `serialize`(stream, base=None, encoding=None, **args)

    Abstract method

## `turtle` Module

Turtle RDF graph serializer for RDFLib. See <http://www.w3.org/TeamSubmission/turtle/> for syntax specification.

class `rdflib.plugins.serializers.turtle.``RecursiveSerializer`(store)

  Bases: `rdflib.serializer.Serializer`

  `__init__`(store)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.turtle'
  `addNamespace`(prefix, uri)
  `buildPredicateHash`(subject)

    Build a hash key by predicate to a list of objects for the given subject

  `checkSubject`(subject)

    Check to see if the subject should be serialized yet

  `indent`(modifier=0)

    Returns indent string multiplied by the depth

  `indentString` = ' '
  `isDone`(subject)

    Return true if subject is serialized

  `maxDepth` = 10
  `orderSubjects`()
  `predicateOrder` = [rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#label')]
  `preprocess`()
  `preprocessTriple`(xxx_todo_changeme)
  `reset`()
  `sortProperties`(properties)

    Take a hash from predicate uris to lists of values. Sort the lists of values. Return a sorted list of properties.

  `subjectDone`(subject)

    Mark a subject as done.

  `topClasses` = [rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#Class')]
  `write`(text)

    Write text in given encoding.

class `rdflib.plugins.serializers.turtle.``TurtleSerializer`(store)

  Bases: `rdflib.plugins.serializers.turtle.RecursiveSerializer`

  `__init__`(store)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.turtle'
  `addNamespace`(prefix, namespace)
  `doList`(l)
  `endDocument`()
  `getQName`(uri, gen_prefix=True)
  `indentString` = ' '
  `isValidList`(l)

    Checks if l is a valid RDF list, i.e. no nodes have other properties.

  `label`(node, position)
  `objectList`(objects)
  `p_default`(node, position, newline=False)
  `p_squared`(node, position, newline=False)
  `path`(node, position, newline=False)
  `predicateList`(subject, newline=False)
  `preprocessTriple`(triple)
  `reset`()
  `s_default`(subject)
  `s_squared`(subject)
  `serialize`(stream, base=None, encoding=None, spacious=None, **args)

    Abstract method

  `short_name` = 'turtle'
  `startDocument`()
  `statement`(subject)
  `verb`(node, newline=False)

## `xmlwriter` Module

class `rdflib.plugins.serializers.xmlwriter.``XMLWriter`(stream, namespace_manager, encoding=None, decl=1, extra_ns=None)

  Bases: `object`

  `__init__`(stream, namespace_manager, encoding=None, decl=1, extra_ns=None)

    Initialize self. See help(type(self)) for accurate signature.

  `__module__` = 'rdflib.plugins.serializers.xmlwriter'
  `attribute`(uri, value)
  `element`(uri, content, attributes={})

    Utility method for adding a complete simple element

  `indent`
  `namespaces`(namespaces=None)
  `pop`(uri=None)
  `push`(uri)
  `qname`(uri)

    Compute qname for a uri using our extra namespaces, or the given namespace manager

  `text`(text)