from SPARQLWrapper import * sparql = SPARQLWrapper("http://localhost:7200/repositories/dummy") sparql.setHTTPAuth(BASIC) sparql.setCredentials("admin", "admin") sparql.setMethod(POST) sparql.setReturnFormat(JSON) sparql.setQuery(""" prefix JEMEntitySH: <https://www.JCIBuildingSchema.org/schema/JEMEntitySH#> SELECT * WHERE { ?s a JEMEntitySH:Campus ; ?p ?o . } LIMIT 10 """) results = sparql.query() print(results.response.read())
#!/usr/bin/env python3 from SPARQLWrapper import * import os import os.path as path import json import glob import time #BaseUrl="http://buda1.bdrc.io:13180/fuseki/bdrcrw/" BaseUrl = "http://localhost:13180/fuseki/corerw/" QueryEndpoint = SPARQLWrapper(BaseUrl + "query") QueryEndpoint.setRequestMethod(POSTDIRECTLY) QueryEndpoint.setMethod(POST) QueryEndpoint.setReturnFormat(JSON) UpdateEndpoint = SPARQLWrapper(BaseUrl + "update") UpdateEndpoint.setRequestMethod(POSTDIRECTLY) UpdateEndpoint.setMethod(POST) ThisPath = os.path.dirname(os.path.abspath(__file__)) def get_all_tests(testgroupname, specifictest=None): grouppath = path.join(ThisPath, testgroupname) res = [] if specifictest is not None: res.append(path.join(grouppath, specifictest)) return res for dirname in sorted(glob.glob(grouppath + "/*")): if path.isdir(dirname): res.append(dirname)
#!/usr/bin/env python3 from SPARQLWrapper import * import os import os.path as path import json import glob import time #BaseUrl="http://buda1.bdrc.io:13180/fuseki/bdrcrw/" BaseUrl="http://localhost:13180/fuseki/bdrcrw/" QueryEndpoint = SPARQLWrapper(BaseUrl+"query") QueryEndpoint.setRequestMethod(POSTDIRECTLY) QueryEndpoint.setMethod(POST) QueryEndpoint.setReturnFormat(JSON) UpdateEndpoint = SPARQLWrapper(BaseUrl+"update") UpdateEndpoint.setRequestMethod(POSTDIRECTLY) UpdateEndpoint.setMethod(POST) ThisPath = os.path.dirname(os.path.abspath(__file__)) def get_all_tests(testgroupname, specifictest=None): grouppath = path.join(ThisPath, testgroupname) res = [] if specifictest is not None: res.append(path.join(grouppath, specifictest)) return res for dirname in sorted(glob.glob(grouppath+"/*")): if path.isdir(dirname): res.append(dirname) return res