4848_SPARQL_DESCRIBE_CONSTRUCT_POSSIBLE = _RDF_XML + _RDF_N3 + _XML + _RDF_JSONLD
4949# only used in test. Same as Wrapper._RDF_POSSIBLE
5050
51- VIRTUOSO_7_20_3230_dbpedia = "https://dbpedia.org/sparql"
51+ VIRTUOSO_8_03_3334_dbpedia = "https://dbpedia.org/sparql"
5252BLAZEGRAPH_WIKIDATA = "https://query.wikidata.org/sparql"
53- GRAPHDB_ENTERPRISE_8_9_0 = "http://factforge.net/repositories/ff-news" # http://factforge.net/
5453RDF4J_GEOSCIML = "http://vocabs.ands.org.au/repository/api/sparql/csiro_international-chronostratigraphic-chart_2018-revised-corrected"
5554ALLEGROGRAPH_AGROVOC = "https://agrovoc.fao.org/sparql"
5655ALLEGROGRAPH_4_14_1_MMI = "https://mmisw.org/sparql" # AllegroServe/1.3.28 http://mmisw.org:10035/doc/release-notes.html
5756FUSEKI_LOV = "https://lov.linkeddata.es/dataset/lov/sparql" # Fuseki - version 1.1.1 (Build date: 2014-10-02T16:36:17+0100)
58- FUSEKI2_3_8_0_STW = "http://zbw.eu/beta/sparql/stw/query" # Fuseki 3.8.0 (Fuseki2)
5957STARDOG_LINDAS = "https://lindas.admin.ch/query" # human UI https://lindas.admin.ch/sparql/
6058STORE4_1_1_4_CHISE = "http://rdf.chise.org/sparql" # 4store SPARQL server v1.1.4
6159
6260# Test parameters
6361@pytest .fixture (params = [
64- VIRTUOSO_7_20_3230_dbpedia ,
65- GRAPHDB_ENTERPRISE_8_9_0 ,
62+ VIRTUOSO_8_03_3334_dbpedia ,
63+ BLAZEGRAPH_WIKIDATA ,
64+ RDF4J_GEOSCIML ,
6665 ALLEGROGRAPH_AGROVOC ,
6766 ALLEGROGRAPH_4_14_1_MMI ,
68- BLAZEGRAPH_WIKIDATA ,
6967 FUSEKI_LOV ,
70- RDF4J_GEOSCIML ,
7168 STARDOG_LINDAS ,
72- STORE4_1_1_4_CHISE ,
73- FUSEKI2_3_8_0_STW ,
69+ STORE4_1_1_4_CHISE
7470])
7571def endpoint (request ):
7672 return request .param
@@ -79,51 +75,7 @@ def endpoint(request):
7975@pytest .fixture
8076def endpoint_config (endpoint ):
8177 """Provide endpoint-specific configurations (prefixes and queries)"""
82- if endpoint == GRAPHDB_ENTERPRISE_8_9_0 :
83- return {
84- "prefixes" : """
85- PREFIX pubo: <http://ontology.ontotext.com/publishing#>
86- PREFIX pub: <http://ontology.ontotext.com/taxonomy/>
87- PREFIX dbr: <http://dbpedia.org/resource/>
88- PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
89- PREFIX ff-map: <http://factforge.net/ff2016-mapping/>
90- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
91- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
92- """ ,
93- "select_query" : """
94- SELECT DISTINCT ?news ?title ?date
95- {
96- ?news ff-map:mentionsEntity dbr:IBM . # one can change the entity here
97- ?news pubo:creationDate ?date ; pubo:title ?title .
98- FILTER ( (?date > "2017-09-01"^^xsd:dateTime) && (?date < "2017-09-15"^^xsd:dateTime))
99- } limit 100
100- """ ,
101- "select_query_csv_tsv" : """
102- SELECT DISTINCT ?news ?title ?date
103- {
104- ?news ff-map:mentionsEntity dbr:IBM . # one can change the entity here
105- ?news pubo:creationDate ?date ; pubo:title ?title .
106- FILTER ( (?date > "2017-09-01"^^xsd:dateTime) && (?date < "2017-09-15"^^xsd:dateTime))
107- } limit 100
108- """ ,
109- "ask_query" : """
110- ASK { <https://weather.com/storms/typhoon/news/typhoon-talim-taiwan-japan-preps-impacts> a ?type }
111- """ ,
112- "construct_query" : """
113- CONSTRUCT {
114- _:v rdfs:label ?label .
115- _:v rdfs:comment "this is only a mock node to test library"
116- }
117- WHERE {
118- <http://dbpedia.org/resource/Asturias> rdfs:label ?label .
119- }
120- """ ,
121- "describe_query" : """
122- DESCRIBE <https://weather.com/storms/typhoon/news/typhoon-talim-taiwan-japan-preps-impacts>
123- """
124- }
125-
126- elif endpoint == ALLEGROGRAPH_AGROVOC :
78+ if endpoint == ALLEGROGRAPH_AGROVOC :
12779 return {
12880 "prefixes" : """
12981 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
@@ -381,41 +333,6 @@ def endpoint_config(endpoint):
381333"""
382334 }
383335
384- elif endpoint == FUSEKI2_3_8_0_STW :
385- return {
386- "prefixes" : """
387- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
388- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
389- PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
390- PREFIX stw: <http://zbw.eu/stw/>
391- """ ,
392- "select_query" : """
393- SELECT ?subject ?predicate ?object WHERE {
394- ?subject ?predicate ?object .
395- } LIMIT 10
396- """ ,
397- "select_query_csv_tsv" : """
398- SELECT ?subject ?predicate ?object WHERE {
399- ?subject ?predicate ?object .
400- } LIMIT 10
401- """ ,
402- "ask_query" : """
403- ASK { <http://zbw.eu/stw/resource/Example> a ?type }
404- """ ,
405- "construct_query" : """
406- CONSTRUCT {
407- _:v skos:prefLabel ?label .
408- _:v rdfs:comment "this is only a mock node to test library"
409- }
410- WHERE {
411- <http://zbw.eu/stw/resource/Example> rdfs:label ?label .
412- }
413- """ ,
414- "describe_query" : """
415- DESCRIBE <http://zbw.eu/stw/resource/Example>
416- """
417- }
418-
419336 else :
420337 return {
421338 "prefixes" : """
@@ -518,11 +435,15 @@ def test_select_query(endpoint, prefixes, select_query, select_query_csv_tsv, re
518435 pytest .skip ("Blazegraph does not support receiving unexpected 'format' values. csv/tsv is not a valid alias. Use content negotiation instead" )
519436 if endpoint in [STARDOG_LINDAS ] and return_format in [XML , "foo" ] and not only_conneg :
520437 pytest .skip ("Stardog fails when query params with XML return type" )
521- if endpoint in [GRAPHDB_ENTERPRISE_8_9_0 , ALLEGROGRAPH_AGROVOC , FUSEKI_LOV , FUSEKI2_3_8_0_STW ] and return_format == JSONLD :
438+ if endpoint in [STARDOG_LINDAS ] and return_format == JSONLD :
439+ pytest .skip ("Stardog now returns CSV for SELECT+JSONLD, which no longer matches this test's fallback expectation" )
440+ if endpoint in [ALLEGROGRAPH_AGROVOC , FUSEKI_LOV ] and return_format == JSONLD :
522441 pytest .skip (f"{ endpoint } does not support unexpected format for SELECT query type" )
523- if endpoint in [STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and method == GET and return_format in ["foo" , TSV , XML , JSONLD ]:
442+ if endpoint in [STORE4_1_1_4_CHISE ] and method == GET and return_format in ["foo" , TSV , XML , JSONLD ]:
524443 pytest .skip ("HTTP Error 500: SPARQL protocol error, or does not support receiving unexpected output values" )
525- if endpoint in [STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and method == POST :
444+ if endpoint in [RDF4J_GEOSCIML ] and method == POST :
445+ pytest .skip (f"{ endpoint } currently rejects POST requests with 400 'Missing parameter: query'" )
446+ if endpoint in [STORE4_1_1_4_CHISE ] and method == POST :
526447 pytest .skip (f"{ endpoint } fails with POST requests" )
527448 # 4store EndPointInternalError: The endpoint returned the HTTP status code 500
528449 # Fuseki2 EndPointNotFound: EndPointNotFound: It was not possible to connect to the given endpoint: check it is correct.
@@ -571,15 +492,19 @@ def test_ask_query(endpoint, prefixes, ask_query, return_format, method, only_co
571492 }
572493 expected_type = expected_type_map [return_format ]
573494
574- if endpoint in [ALLEGROGRAPH_4_14_1_MMI , GRAPHDB_ENTERPRISE_8_9_0 , BLAZEGRAPH_WIKIDATA , RDF4J_GEOSCIML , STARDOG_LINDAS ] and return_format in [CSV , TSV ]:
495+ if endpoint in [ALLEGROGRAPH_4_14_1_MMI , BLAZEGRAPH_WIKIDATA , RDF4J_GEOSCIML , STARDOG_LINDAS ] and return_format in [CSV , TSV ]:
575496 pytest .skip ("CSV/TSV not supported currently for ASK query type" )
576497 if endpoint in [STARDOG_LINDAS ] and return_format in [XML , "foo" ] and not only_conneg :
577498 pytest .skip ("Stardog fails when query params with unknown return type" )
578- if endpoint in [VIRTUOSO_7_20_3230_dbpedia , GRAPHDB_ENTERPRISE_8_9_0 , ALLEGROGRAPH_AGROVOC , FUSEKI_LOV , STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and return_format in [N3 ]:
499+ if endpoint in [STARDOG_LINDAS ] and return_format == N3 :
500+ pytest .skip ("Stardog now returns JSON for ASK+N3, which no longer matches this test's fallback expectation" )
501+ if endpoint in [VIRTUOSO_8_03_3334_dbpedia , ALLEGROGRAPH_AGROVOC , FUSEKI_LOV , STORE4_1_1_4_CHISE ] and return_format in [N3 ]:
579502 pytest .skip ("{endpoint} fails when unexpected return type" )
580503 if endpoint in [STORE4_1_1_4_CHISE ] and method == GET and return_format in ["foo" , TSV , XML ]:
581504 pytest .skip ("HTTP Error 500: SPARQL protocol error, or does not support receiving unexpected output values" )
582- if endpoint in [STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and (method == POST or return_format == N3 ):
505+ if endpoint in [RDF4J_GEOSCIML ] and method == POST :
506+ pytest .skip (f"{ endpoint } currently rejects POST requests with 400 'Missing parameter: query'" )
507+ if endpoint in [STORE4_1_1_4_CHISE ] and (method == POST or return_format == N3 ):
583508 pytest .skip (f"{ endpoint } fails with POST requests" )
584509 # 4store EndPointInternalError: The endpoint returned the HTTP status code 500
585510 # Fuseki2 EndPointNotFound: EndPointNotFound: It was not possible to connect to the given endpoint: check it is correct.
@@ -629,13 +554,15 @@ def test_construct_query(endpoint, prefixes, construct_query, return_format, met
629554 pytest .skip (f"{ endpoint } JSON-LD is not supported currently" )
630555 if endpoint in [BLAZEGRAPH_WIKIDATA ] and not only_conneg and return_format in [TURTLE , JSONLD , N3 ]:
631556 pytest .skip (f"{ endpoint } Blazegraph does not support receiving unexpected 'format' values. Use content negotiation instead" )
632- if endpoint in [BLAZEGRAPH_WIKIDATA , ALLEGROGRAPH_AGROVOC , STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and not only_conneg and return_format in [N3 , RDFXML ]:
557+ if endpoint in [BLAZEGRAPH_WIKIDATA , ALLEGROGRAPH_AGROVOC , STORE4_1_1_4_CHISE ] and not only_conneg and return_format in [N3 , RDFXML ]:
633558 pytest .skip (f"{ endpoint } Allegrograph fails when query params with unexpected N3 or RDFXML return type" )
634559 if endpoint in [STORE4_1_1_4_CHISE ] and method == GET and return_format in ["foo" , TSV , XML , TURTLE ]:
635560 pytest .skip ("HTTP Error 500: SPARQL protocol error, or does not support receiving unexpected output values" )
636561 if endpoint in [STORE4_1_1_4_CHISE ] and return_format in [JSONLD ]:
637562 pytest .skip ("4store do not stupport JSON-LD" )
638- if endpoint in [STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and method == POST :
563+ if endpoint in [RDF4J_GEOSCIML ] and method == POST :
564+ pytest .skip (f"{ endpoint } currently rejects POST requests with 400 'Missing parameter: query'" )
565+ if endpoint in [STORE4_1_1_4_CHISE ] and method == POST :
639566 pytest .skip (f"{ endpoint } fails with POST requests" )
640567 # 4store EndPointInternalError: The endpoint returned the HTTP status code 500
641568 # Fuseki2 EndPointNotFound: EndPointNotFound: It was not possible to connect to the given endpoint: check it is correct.
@@ -686,19 +613,19 @@ def test_describe_query(endpoint, prefixes, describe_query, return_format, metho
686613 pytest .skip (f"{ endpoint } Blazegraph does not support receiving unexpected 'format' values. Use content negotiation instead" )
687614 if endpoint in [STORE4_1_1_4_CHISE ] and method == GET and return_format in ["foo" , N3 , XML , TURTLE , JSONLD ]:
688615 pytest .skip ("4store only works with RDFXML when using GET with describe apparently" )
689- if endpoint in [VIRTUOSO_7_20_3230_dbpedia ] and return_format in [JSONLD ] and method == POST and not only_conneg :
616+ if endpoint in [VIRTUOSO_8_03_3334_dbpedia ] and return_format in [JSONLD ] and method == POST and not only_conneg :
690617 pytest .skip ("{endpoint} fails when asked for JSON-LD + POST + query params" )
691- if endpoint in [FUSEKI2_3_8_0_STW , STORE4_1_1_4_CHISE ] and return_format in [RDFXML ] and method == GET and not only_conneg :
618+ if endpoint in [STORE4_1_1_4_CHISE ] and return_format in [RDFXML ] and method == GET and not only_conneg :
692619 pytest .skip ("{endpoint} fails when asked for RDFXML + GET + query params" )
693620 if endpoint in [ALLEGROGRAPH_AGROVOC ] and return_format in [N3 , RDFXML ] and not only_conneg :
694621 pytest .skip ("{endpoint} fails when asked for RDFXML/N3 + query params" )
695- if endpoint in [FUSEKI2_3_8_0_STW ] and return_format in [ N3 ] :
696- pytest .skip ("{endpoint} Fuseki2 fails when n3 asked " )
697- if endpoint in [STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and method == POST :
622+ if endpoint in [RDF4J_GEOSCIML ] and method == POST :
623+ pytest .skip (f "{ endpoint } currently rejects POST requests with 400 'Missing parameter: query' " )
624+ if endpoint in [STORE4_1_1_4_CHISE ] and method == POST :
698625 pytest .skip (f"{ endpoint } fails with POST requests" )
699626 # 4store EndPointInternalError: The endpoint returned the HTTP status code 500
700627 # Fuseki2 EndPointNotFound: EndPointNotFound: It was not possible to connect to the given endpoint: check it is correct.
701- if endpoint in [VIRTUOSO_7_20_3230_dbpedia , GRAPHDB_ENTERPRISE_8_9_0 , ALLEGROGRAPH_AGROVOC , FUSEKI_LOV , RDF4J_GEOSCIML , STARDOG_LINDAS , STORE4_1_1_4_CHISE , FUSEKI2_3_8_0_STW ] and return_format in [CSV ]:
628+ if endpoint in [VIRTUOSO_8_03_3334_dbpedia , ALLEGROGRAPH_AGROVOC , FUSEKI_LOV , RDF4J_GEOSCIML , STARDOG_LINDAS , STORE4_1_1_4_CHISE ] and return_format in [CSV ]:
702629 # TODO: is it all of them?
703630 pytest .skip ("{endpoint} fails when unexpected return type" )
704631
@@ -792,7 +719,7 @@ def test_query_many_prefixes(endpoint) -> None:
792719# A prefix declared with the PREFIX keyword may not be re-declared in the same query.
793720def test_query_duplicated_prefix (endpoint ):
794721 """Tests that queries with duplicated prefixes work"""
795- if endpoint in [GRAPHDB_ENTERPRISE_8_9_0 , RDF4J_GEOSCIML , BLAZEGRAPH_WIKIDATA ]:
722+ if endpoint in [RDF4J_GEOSCIML , BLAZEGRAPH_WIKIDATA , STARDOG_LINDAS ]:
796723 pytest .skip (f"Skipping test for { endpoint } as it doesn't support duplicated prefixes" )
797724 result = query_sparql (endpoint , """
798725 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
@@ -807,7 +734,7 @@ def test_query_duplicated_prefix(endpoint):
807734
808735def test_query_with_comma_in_curie_1 (endpoint ):
809736 """Tests queries with commas in CURIEs"""
810- if endpoint in [VIRTUOSO_7_20_3230_dbpedia , STORE4_1_1_4_CHISE ]:
737+ if endpoint in [VIRTUOSO_8_03_3334_dbpedia , STORE4_1_1_4_CHISE ]:
811738 pytest .skip (f"Skipping test for { endpoint } . Returns a QueryBadFormed Error. See #94" )
812739 result = query_sparql (endpoint , """
813740 PREFIX dbpedia: <http://dbpedia.org/resource/>
@@ -831,7 +758,7 @@ def test_query_with_comma_in_uri(endpoint):
831758# Skipped by all endpoints anyway
832759# def test_query_with_comma_in_curie_2(endpoint):
833760# """Tests queries with commas in CURIEs with colons"""
834- # if endpoint in [VIRTUOSO_7_20_3230_dbpedia, GRAPHDB_ENTERPRISE_8_9_0, ALLEGROGRAPH_ON_HOLD_AGROVOC, ALLEGROGRAPH_4_14_1_MMI, BLAZEGRAPH_WIKIDATA, RDF4J_GEOSCIML, STARDOG_LINDAS, STORE4_1_1_4_CHISE, FUSEKI2_3_8_0_STW ]:
761+ # if endpoint in [VIRTUOSO_8_03_3334_dbpedia, ALLEGROGRAPH_ON_HOLD_AGROVOC, ALLEGROGRAPH_4_14_1_MMI, BLAZEGRAPH_WIKIDATA, RDF4J_GEOSCIML, STARDOG_LINDAS, STORE4_1_1_4_CHISE]:
835762# pytest.skip(f"Skipping test for {endpoint}. Returns a QueryBadFormed Error. See #94")
836763# result = query_sparql(endpoint, """
837764# PREFIX dbpedia: <http://dbpedia.org/resource/>
0 commit comments