コード例 #1
0
def to_xml(document=None):
    """
    Try to convert a document into an xml string

    :param document: The ProvDocument to convert
    :param document: ProvDocument
    :return: The xml string
    :rtype: str
    """
    if document is None:
        raise NoDocumentException()
    return document.serialize(format='xml')
コード例 #2
0
def to_json(document=None):
    """
    Try to convert a ProvDocument into the json representation

    :param document:
    :type document: prov.model.ProvDocument
    :return: Json string of the document
    :rtype: str
    """
    if document is None:
        raise NoDocumentException()
    return document.serialize(format='json')
コード例 #3
0
def from_xml(xml_str=None):
    """
    Try to convert a xml string into a ProvDocument

    :param xml_str: The xml string
    :type xml_str: str
    :return: The Prov document
    :rtype: ProvDocument
    """
    if xml_str is None:
        raise NoDocumentException()
    return ProvDocument.deserialize(source=xml_str, format='xml')
コード例 #4
0
def from_provn(provn_str=None):
    """
    Try to convert a provn string into a ProvDocument

    :param provn_str: The string to convert
    :type provn_str: str
    :return: The Prov document
    :rtype: ProvDocument
    :raises: NoDocumentException
    """
    if provn_str is None:
        raise NoDocumentException()
    return ProvDocument.deserialize(source=provn_str, format='provn')
コード例 #5
0
def to_provn(document=None):
    """
    Try to convert a document into a provn representation

    :param document: Prov document to convert
    :type document: prov.model.ProvDocument
    :return: The prov-n str
    :rtype: str
    :raise: NoDocumentException
    """
    if document is None:
        raise NoDocumentException()
    return document.serialize(format='provn')
コード例 #6
0
def from_json(json=None):
    """
    Try to convert a json string into a document

    :param json: The json str
    :type json: str
    :return: Prov Document
    :rtype: prov.model.ProvDocument
    :raise: NoDocumentException
    """
    if json is None:
        raise NoDocumentException()
    return ProvDocument.deserialize(source=json, format='json')
コード例 #7
0
def from_xml(document=None):
    if document is None:
        raise NoDocumentException()
    return ProvDocument.deserialize(source=document, format='xml')
コード例 #8
0
def to_xml(document=None):
    if document is None:
        raise NoDocumentException()
    return document.serialize(format='xml')
コード例 #9
0
def to_provn(document=None):
    if document is None:
        raise NoDocumentException()
    return document.serialize(format='provn')