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


Python Session.sparql_query方法代码示例

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


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

示例1: breaks

# 需要导入模块: from Session import Session [as 别名]
# 或者: from Session.Session import sparql_query [as 别名]
              .replace("  ", "").replace("\t", ""))

currentObjs = rdf_session.store_sizes()[0]

# Execute each sparql rule over until the number of new objects
# doesn't change. Once the total of objects stabilises, then the
# loop breaks (as rules can inference each other).
#
while currentObjs - initialObjs > 0:
    initialObjs = currentObjs
    for queryObj in orderOfService:
        # if config print rule executuon
        if Config.DEBUG > 0:
            print "Executing query: " + queryObj[0]

        res = rdf_session.sparql_query(queryObj[1], False)
        # if config, print result
        if Config.DEBUG > 0:
            print ">>" + str(res)
        if res:
            for sub, pred, obj in res:
                # add assertion
                rdf_session.add_assertion([sub, pred, obj], queryObj[4], True)
                # commit assertion
                rdf_session.commit()
        resList = []
    currentObjs = rdf_session.store_sizes()[0]
    rdf_session.commit()
    currentObjs = rdf_session.store_sizes()[0]

    # check sizes - how many new assertions
开发者ID:benjaminturnbull,项目名称:ParFor,代码行数:33,代码来源:SPARQLer.py

示例2: get_reasoner

# 需要导入模块: from Session import Session [as 别名]
# 或者: from Session.Session import sparql_query [as 别名]
    INPUTOBJURI = get_reasoner(INPUTOBJNAME)
    rdf_session.set_metadata_properties(INPUTOBJNAME, INPUTOBJURI, 0, "date")

    uningested_part_q = """
    select ?s ?m ?g {graph ?g {
    ?s rdf:type fs:Partition .
    ?s base:mountPoint ?m .
    MINUS {?s fs:contains ?y .
    ?y rdf:type fs:File .
    }
    }
    }    
    """

    partition_resp = rdf_session.sparql_query(uningested_part_q)
    partition_list = []

    for ta in partition_resp:
        if len(ta) > 0:
            sub = None
            mount = None
            if "s" in ta:
                sub = ta["s"]["value"]
            if "m" in ta:
                mount = ta["m"]["value"]
            if sub and mount:
                print sub + "***" + mount
                partition_list.append([sub, mount])
#    print partition_list
开发者ID:benjaminturnbull,项目名称:ParFor,代码行数:31,代码来源:DataIngestion_FileSystems_Dirs_Files.py


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