prov.serializers package¶
Module contents¶
prov.serializers.provjson module¶
-
class
prov.serializers.provjson.
ProvJSONSerializer
(document=None)[source]¶ Bases:
prov.serializers.Serializer
PROV-JSON serializer for
ProvDocument
-
deserialize
(stream, **kwargs)[source]¶ Deserialize from the PROV JSON representation to a
ProvDocument
instance.Parameters: stream – Input data.
-
serialize
(stream, **kwargs)[source]¶ Serializes a
ProvDocument
instance to PROV-JSON.Parameters: stream – Where to save the output.
-
prov.serializers.provn module¶
prov.serializers.provxml module¶
-
class
prov.serializers.provxml.
ProvXMLSerializer
(document=None)[source]¶ Bases:
prov.serializers.Serializer
PROV-XML serializer for
ProvDocument
-
deserialize
(stream, **kwargs)[source]¶ Deserialize from PROV-XML representation to a
ProvDocument
instance.Parameters: stream – Input data.
-
deserialize_subtree
(xml_doc, bundle)[source]¶ Deserialize an etree element containing a PROV document or a bundle and write it to the provided internal object.
Parameters: - xml_doc – An etree element containing the information to read.
- bundle – The bundle object to write to.
-
serialize
(stream, force_types=False, **kwargs)[source]¶ Serializes a
ProvDocument
instance to PROV-XML.Parameters: - stream – Where to save the output.
- force_types (boolean, optional) – Will force xsd:types to be written for most attributes mainly PROV-“attributes”, e.g. tags not in the PROV namespace. Off by default meaning xsd:type attributes will only be set for prov:type, prov:location, and prov:value as is done in the official PROV-XML specification. Furthermore the types will always be set if the Python type requires it. False is a good default and it should rarely require changing.
-
serialize_bundle
(bundle, element=None, force_types=False)[source]¶ Serializes a bundle or document to PROV XML.
Parameters: - bundle – The bundle or document.
- element – The XML element to write to. Will be created if None.
- force_types (boolean, optional) – Will force xsd:types to be written for most attributes mainly PROV-“attributes”, e.g. tags not in the PROV namespace. Off by default meaning xsd:type attributes will only be set for prov:type, prov:location, and prov:value as is done in the official PROV-XML specification. Furthermore the types will always be set if the Python type requires it. False is a good default and it should rarely require changing.
-