diff --git a/lib/sparesults/src/json.rs b/lib/sparesults/src/json.rs index cfe795d7..9e9772c6 100644 --- a/lib/sparesults/src/json.rs +++ b/lib/sparesults/src/json.rs @@ -316,7 +316,7 @@ impl JsonSolutionsReader { match s { "uri" => t = Some(Type::Uri), "bnode" => t = Some(Type::BNode), - "literal" => t = Some(Type::Literal), + "literal" | "typed-literal" => t = Some(Type::Literal), #[cfg(feature = "rdf-star")] "triple" => t = Some(Type::Triple), _ => { diff --git a/server/src/main.rs b/server/src/main.rs index f363be8c..49659636 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1293,13 +1293,21 @@ mod tests { } #[test] - fn post_federated_query() { + fn post_federated_query_wikidata() { let request = Request::builder(Method::POST, "http://localhost/query".parse().unwrap()) .with_header(HeaderName::CONTENT_TYPE, "application/sparql-query") .unwrap().with_body("SELECT * WHERE { SERVICE { ?p ?o } }"); ServerTest::new().test_status(request, Status::OK) } + #[test] + fn post_federated_query_dbpedia() { + let request = Request::builder(Method::POST, "http://localhost/query".parse().unwrap()) + .with_header(HeaderName::CONTENT_TYPE, "application/sparql-query") + .unwrap().with_body("SELECT * WHERE { SERVICE { ?p ?o } }"); + ServerTest::new().test_status(request, Status::OK) + } + #[test] fn post_update() { let request = Request::builder(Method::POST, "http://localhost/update".parse().unwrap()) diff --git a/testsuite/oxigraph-tests/sparql-results/manifest.ttl b/testsuite/oxigraph-tests/sparql-results/manifest.ttl index bdf637bf..03e276ec 100644 --- a/testsuite/oxigraph-tests/sparql-results/manifest.ttl +++ b/testsuite/oxigraph-tests/sparql-results/manifest.ttl @@ -13,6 +13,7 @@ :results_tsv_duplicated_variables :results_json_ignored_keys :results_xml_ignored_keys + :results_json_typed_literal ) . :results_json_duplicated_variables rdf:type ox:NegativeJsonResultsSyntaxTest ; @@ -34,3 +35,7 @@ :results_xml_ignored_keys rdf:type ox:PositiveXmlResultsSyntaxTest ; mf:name "Ignore unknown attributes on tags" ; mf:action . + +:results_json_typed_literal rdf:type ox:PositiveJsonResultsSyntaxTest ; + mf:name "typed-literal term type is allowed" ; + mf:action . diff --git a/testsuite/oxigraph-tests/sparql-results/typed_literal.srj b/testsuite/oxigraph-tests/sparql-results/typed_literal.srj new file mode 100644 index 00000000..3e81efba --- /dev/null +++ b/testsuite/oxigraph-tests/sparql-results/typed_literal.srj @@ -0,0 +1,16 @@ +{ + "head": { + "vars": ["s"] + }, + "results": { + "bindings": [ + { + "s": { + "type": "typed-literal", + "value": "foo", + "datatype": "http://example.com/dt" + } + } + ] + } +}