Beispiel #1
0
 def __init__(self, session, config, parent):
     BaseParser.__init__(self, session, config, parent)
     rdfaOptions = Options(warnings=False)
     rdfaOptions.warning_graph = None
     self.options = rdfaOptions
Beispiel #2
0
    def parse(self, doc):
        # parse to find graph
        graph =  Graph()
        data = StringInputSource(doc.data)
        if doc.format:
            graph.parse(data, format=doc.format)
        else:
            graph.parse(data)
        return self.process_graph(graph)


try:
    # Try to use more featureful pyRDFa parser
    from pyRdfa import parseRDFa, Options
    rdfaOptions = Options(warnings=False)
    rdfaOptions.warning_graph = None

    class RdfAParser(RdfLibParser):
        def parse(self, doc):
            root = minidom.parse(doc)
            graph = parseRDFa(root, doc.uri, options=rdfaOptions)
            return self.process_graph(graph)

except ImportError:
    # No pyRdfa lib, default to using rdflib's parser

    class RdfAParser(RdfLibParser):
        pass


class AtomParser(OREParser):
Beispiel #3
0
    def parse(self, doc):
        # parse to find graph
        graph = Graph()
        data = StringInputSource(doc.data)
        if doc.format:
            graph.parse(data, format=doc.format)
        else:
            graph.parse(data)
        return self.process_graph(graph)


try:
    # Try to use more featureful pyRDFa parser
    from pyRdfa import parseRDFa, Options
    rdfaOptions = Options(warnings=False)
    rdfaOptions.warning_graph = None

    class RdfAParser(RdfLibParser):
        def parse(self, doc):
            root = minidom.parse(doc)
            graph = parseRDFa(root, doc.uri, options=rdfaOptions)
            return self.process_graph(graph)

except ImportError:
    # No pyRdfa lib, default to using rdflib's parser

    class RdfAParser(RdfLibParser):
        pass


class AtomParser(OREParser):
Beispiel #4
0
 def __init__(self, session, config, parent):
     BaseParser.__init__(self, session, config, parent)
     rdfaOptions = Options(warnings=False)
     rdfaOptions.warning_graph = None
     self.options = rdfaOptions