当前位置: 首页>>代码示例>>Python>>正文


Python Graph.__init__方法代码示例

本文整理汇总了Python中rdflib.Graph.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.__init__方法的具体用法?Python Graph.__init__怎么用?Python Graph.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rdflib.Graph的用法示例。


在下文中一共展示了Graph.__init__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import __init__ [as 别名]
 def __init__(self, filepath, uri):
     graph.__init__(self)
     self.parse(filepath, format='turtle')
     self.filename = os.path.basename(filepath)
     self.uri = uri
     print(" - Resource {0} has {1} triples.".format(
                                                 self.filename, len(self)))
开发者ID:awoods,项目名称:fcrepo-serial-restore,代码行数:9,代码来源:restore.py

示例2: __init__

# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import __init__ [as 别名]
    def __init__(self, config, section, fmt="nt"):
        """
        Initialize the template_graph, with specified config file and section.
        Load triples that are in the "added_triples" file, but not in "base_triples".
        """
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        Graph.__init__(self)
        self.config = ConfigParser.ConfigParser()
        self.config.read(config)
        if section:
            self.cfg_section = section
        self.set_format(fmt)
        self.set_namespace("http://vivo.dartmouth.edu/individual/")
        self._umap = {}
        self._all = True
        self._filter = False

        fn = self.get_config("added_triples")
        self.parse(fn, format=self._format)

        try:
            fn = self.get_config("base_triples")
            if fn:
                self.subtract(fn)
                print "new triples:"
                print super(TemplateGraph, self).serialize(format=self._format)
        except:
            pass
开发者ID:KevinHanson,项目名称:vivo-csv-tools,代码行数:30,代码来源:template_graph.py

示例3: __init__

# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import __init__ [as 别名]
	def __init__(self) :
		Graph.__init__(self)
开发者ID:daattaa,项目名称:pyrdfa3,代码行数:4,代码来源:__init__.py

示例4: __init__

# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import __init__ [as 别名]
 def __init__(self):
     Graph.__init__(self, namespace_manager=ns_mgr)
开发者ID:lawlesst,项目名称:vivo-utils,代码行数:4,代码来源:vivo.py

示例5: __init__

# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import __init__ [as 别名]
	def __init__(self) :
		Graph.__init__(self)
		for (prefix,uri) in _bindings :
			self.bind(prefix,Namespace(uri))
开发者ID:RDFLib,项目名称:PyRDFa,代码行数:6,代码来源:graph.py

示例6: __init__

# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import __init__ [as 别名]
    def __init__(self):
        Graph.__init__(self)

        #   Person with orcid and research areas

        self.add((URIRef('http://vivo.school.edu/individual/n25674'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))
        self.add((URIRef('http://vivo.school.edu/individual/n25674'), RDFS.label,
                  Literal("Doe, John")))
        self.add((URIRef('http://vivo.school.edu/individual/n25674'),
                  URIRef('http://vivoweb.org/ontology/core#orcid'),
                  Literal("http://orcid.org/0000-0002-1305-8447")))
        self.add((URIRef('http://vivo.school.edu/individual/n25674'),
                  URIRef('http://vivoweb.org/ontology/core#hasResearchArea'),
                  URIRef('http://any1')))
        self.add((URIRef('http://vivo.school.edu/individual/n25674'),
                  URIRef('http://vivoweb.org/ontology/core#hasResearchArea'),
                  URIRef('http://any2')))
        self.add((URIRef('http://vivo.school.edu/individual/n25674'),
                  URIRef('http://vivoweb.org/ontology/core#hasResearchArea'),
                  URIRef('http://any3')))
        self.add((URIRef('http://vivo.school.edu/individual/n25674'),
                  URIRef('http://vivoweb.org/ontology/core#hasResearchArea'),
                  URIRef('http://any4')))

        #   Course

        self.add((URIRef('http://vivo.school.edu/individual/n7501'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))
        self.add((URIRef('http://vivo.school.edu/individual/n7501'), RDFS.label,
                  Literal("Introduction to Statistics")))

        #   Date

        self.add((URIRef("http://vivo.school.edu/individual/n8968236376"), RDF.type,
                  URIRef('http://vivoweb.org/ontology/core#DateTimeValue')))
        self.add((URIRef("http://vivo.school.edu/individual/n8968236376"),
                  URIRef('http://vivoweb.org/ontology/core#dateTime'),
                  Literal("2012-01-01", datatype=XSD.datetime)))

        #   Another Date

        self.add((URIRef('http://vivo.school.edu/individual/n2871342684'), RDF.type,
                  URIRef('http://vivoweb.org/ontology/core#DateTimeValue')))
        self.add((URIRef('http://vivo.school.edu/individual/n2871342684'),
                  URIRef('http://vivoweb.org/ontology/core#dateTime'),
                  Literal("2013-01-01", datatype=XSD.datetime)))

        #   Person with multiple types

        self.add((URIRef('http://vivo.school.edu/individual/n1723097935'), RDF.type,
                  URIRef('http://vivoweb.org/ontology/core#FacultyMember')))
        self.add((URIRef('http://vivo.school.edu/individual/n1723097935'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))

        #   Authorship

        self.add((URIRef('http://vivo.school.edu/individual/n1412'), RDF.type,
                  URIRef('http://vivoweb.org/ontology/core#Authorship')))
        self.add((URIRef('http://vivo.school.edu/individual/n1412'), URIRef('http://any'),
                  URIRef('http://vivo.school.edu/individual/n25674')))

        #   Person with no attributes

        self.add((URIRef('http://vivo.school.edu/individual/n2084211328'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))

        #   Person with no attributes

        self.add((URIRef('http://vivo.school.edu/individual/n708'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))

        #   Person with no attributes

        self.add((URIRef('http://vivo.school.edu/individual/n709'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))

        #   Person with no attributes

        self.add((URIRef('http://vivo.school.edu/individual/n710'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))

        #   Person with Unicode in name

        self.add((URIRef('http://vivo.school.edu/individual/n711'), RDF.type,
                  URIRef('http://xmlns.com/foaf/0.1/Person')))
        self.add((URIRef('http://vivo.school.edu/individual/n711'), RDFS.label,
                  Literal('Ελληνικά')))

        #   Building with name and abbreviation

        self.add((URIRef('http://vivo.school.edu/individual/n1001011525'), RDF.type,
                  URIRef('http://vivoweb.org/ontology/core#Building')))
        self.add((URIRef('http://vivo.school.edu/individual/n1001011525'), RDFS.label,
                  Literal("Building 42")))
        self.add((URIRef('http://vivo.school.edu/individual/n1001011525'),
                  URIRef('http://vivoweb.org/ontology/core#abbreviation'),
                  Literal("JWRU", datatype=XSD.string)))

        #   org no address
#.........这里部分代码省略.........
开发者ID:ctsit,项目名称:vivo-pump,代码行数:103,代码来源:testgraph.py


注:本文中的rdflib.Graph.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。