def testQueryToStardog(self): main([ "-e", "https://lindas.admin.ch/query", "-Q", testquery, "-m", POST ]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "http://classifications.data.admin.ch/canton/bl" } } ] } } """), )
def testQueryWithEndpoint(self): main([ "-Q", testquery, "-e", endpoint, ]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "link": [], "vars": [ "x" ] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "x": { "type": "uri", "value": "http://www.openlinksw.com/virtrdf-data-formats#default-iid" } } ] } } """), )
def testQueryToLovFuseki(self): main([ "-e", "https://lov.linkeddata.es/dataset/lov/sparql/", "-Q", testquery ]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "http://www.w3.org/2002/07/owl#someValuesFrom" } } ] } } """), )
def testQueryToGraphDBEnterprise(self): main([ "-e", "http://factforge.net/repositories/ff-news", "-Q", testquery ]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" } } ] } } """), )
def testQueryToRDF4J(self): main([ "-e", "http://vocabs.ands.org.au/repository/api/sparql/csiro_international-chronostratigraphic-chart_2018-revised-corrected", "-Q", testquery, ]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" } } ] } } """), )
def testQueryWithFile(self): main(["-f", testfile, "-e", endpoint]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "link": [], "vars": [ "pllabel" ] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "pllabel": { "type": "literal", "xml:lang": "ja", "value": "PARLOG" } } ] } } """), )
def testQueryWithFileTSV(self): main(["-f", testfile, "-e", endpoint, "-F", "tsv"]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ "pllabel" "PARLOG"\n """), )
def testQueryWithFileN3(self): main(["-f", testfile, "-e", endpoint, "-F", "n3"]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ @prefix res: <http://www.w3.org/2005/sparql-results#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . _:_ a res:ResultSet . _:_ res:resultVariable "pllabel" . _:_ res:solution [ res:binding [ res:variable "pllabel" ; res:value "PARLOG"@ja ] ] .\n """), )
def testQueryWithFileRDFXML(self): main(["-f", testfile, "-e", endpoint, "-F", "rdf+xml"]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ <?xml version="1.0" ?><sparql xmlns="http://www.w3.org/2005/sparql-results#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd"> <head> <variable name="pllabel"/> </head> <results distinct="false" ordered="true"> <result> <binding name="pllabel"><literal xml:lang="ja">PARLOG</literal></binding> </result> </results> </sparql> """), )
def testQueryRDF(self): main([ "-Q", "DESCRIBE <http://ja.wikipedia.org/wiki/SPARQL>", "-e", endpoint, "-F", "rdf" ]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://ja.dbpedia.org/resource/SPARQL> foaf:isPrimaryTopicOf <http://ja.wikipedia.org/wiki/SPARQL> . <http://ja.wikipedia.org/wiki/SPARQL> a foaf:Document ; dc:language "ja" ; foaf:primaryTopic <http://ja.dbpedia.org/resource/SPARQL> . """), )
def testQueryTo4store(self): main(["-e", "http://rdf.chise.org/sparql", "-Q", testquery]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "bnode", "value": "b1f4d352f000000fc" } } ] } } """), )
def testQueryToFuseki2V3_8(self): main(["-e", "http://zbw.eu/beta/sparql/stw/query", "-Q", testquery]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "http://www.w3.org/2004/02/skos/core" } } ] } } """), )
def testQueryToFuseki2V3_6(self): main(["-e", "https://agrovoc.uniroma2.it/sparql/", "-Q", testquery]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "http://aims.fao.org/aos/agrovoc/" } } ] } } """), )
def testQueryToBrazeGraph(self): main(["-e", "https://query.wikidata.org/sparql", "-Q", testquery]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "http://wikiba.se/ontology#Dump" } } ] } } """), )
def testQueryToAllegroGraph(self): main(["-e", "https://mmisw.org/sparql", "-Q", testquery]) self.assertEqual( sys.stdout.getvalue(), textwrap.dedent("""\ { "head": { "vars": [ "x" ] }, "results": { "bindings": [ { "x": { "type": "uri", "value": "https://mmisw.org/ont/~mjuckes/cmip_variables_alpha/rsdcs4co2" } } ] } } """), )