Closed namedgraph closed 9 years ago
curl -X POST -d @describe-case.rq -H "Content-Type: application/sparql-query" -H "Accept: text/turtle" "http://graphity.dydra.com/graphity/homepage-test/sparql"
versus
curl -X POST -d @describe-this.rq -H "Content-Type: application/sparql-query" -H "Accept: text/turtle" "http://graphity.dydra.com/graphity/homepage-test/sparql?%24agent=%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FAgent%3E&%24this=%3Chttp%3A%2F%2Flocalhost%3A8080%2Fgraphity-homepage%2Fcases%2Fstatsbiblioteket%3E"
describe-case.rq
:
BASE <http://localhost:8080/graphity-homepage/>
PREFIX describeForm: <urn:dydra:simple-concise-bounded-description>
PREFIX describeSubjectDepth: <http://www.w3.org/1999/02/22-rdf-syntax-ns#_4>
DESCRIBE <cases/statsbiblioteket> ?topic
WHERE
{ GRAPH ?graph
{ ?topic <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> <cases/statsbiblioteket> }
}
describe-this.rq
:
BASE <http://localhost:8080/graphity-homepage/>
PREFIX describeForm: <urn:dydra:simple-concise-bounded-description>
PREFIX describeSubjectDepth: <http://www.w3.org/1999/02/22-rdf-syntax-ns#_4>
DESCRIBE ?this ?topic
WHERE
{ GRAPH ?graph
{ ?topic <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?this }
}
the issue devolves to the same one which we discussed at the time when we released request query parameters: they are not interpolated into a query text, but rather serve as values for variables which would be bound by patterns. in this situation, the example query produces no result because the base pattern matches no statement in the store and reduces to a null field. at which point the describe has nothing to describe and the query returns no result.
curl -X POST \
> --data-binary @- \
> -H "Content-Type: application/sparql-query" \
> -H "Accept: application/sparql-results+json" \
> "http://graphity.dydra.com/graphity/homepage-test/sparql" <<EOF
> BASE <http://localhost:8080/graphity-homepage/>
> PREFIX describeForm: <urn:dydra:simple-concise-bounded-description>
> PREFIX describeSubjectDepth: <http://www.w3.org/1999/02/22-rdf-syntax-ns#_4>
>
> select (count(*) as ?count)
> WHERE
> { GRAPH ?graph
> { ?topic <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> <cases/statsbiblioteket> }
> }
> EOF
{
"head": {
"vars": [
"count"
]
},
"results": {
"bindings": [
{
"count": {
"type": "literal",
"value": "0",
"datatype": "http:\/\/www.w3.org\/2001\/XMLSchema#integer"
}
}
]
}
}
Query with
?this
set tohttp://localhost:8080/graphity-homepage/cases/statsbiblioteket
returns 9 results: http://graphity.dydra.com/graphity/homepage-test/query#describecaseThe same query with remote bindings returns no results (
Authorization
header removed):