On the query page, there is a "prefixes" area above the endpoint setting
for inserting prefixes.
For queries from a program, prepend some text to each query sent in
whatever programming language you are using. If a prefix is redefined
twice in syntax, the second overwrites the definition:
PREFIX ex: <http:/example.org/>
PREFIX ex: <http:/example.org/ex#>
"ex:" is "http:/example.org/ex#"
Contributions for improvements welcome!
Andy
On 03/09/2021 08:11, Michael Wechner wrote:
Thanks for the clarifying example!
Similar to wikidata query https://query.wikidata.org/ where you can
enter a query without defining prefixes, for example
SELECT ?item ?itemLabel ?dateOfBirth ?workLabel WHERE {
?item wdt:P31 wd:Q5.
?item ?label "Alfred Hitchcock"@en .
OPTIONAL{?item wdt:P800 ?work.}
OPTIONAL{?item wdt:P569 ?dateOfBirth .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
I agreee, for standard prefixes like for example "rdfs" this would be
very convenient, but I don't know whether this feature does not exist by
design or because it was not a high priority yet or whether it exists,
but requires some configuration.
Does anyone else know?
Thanks
Michael
Am 03.09.21 um 08:51 schrieb Laura Morales:
What I mean is really simple. Basically I'd like to send queries like
this to Fuseki:
SELECT ?l
WHERE { ?s rdfs:label ?l }
this is not a valid query because it does not define the rdfs prefix.
But I'd like to prepend some standard prefixes to every incoming
request before they are executed. So the request above is transformed
into this before being executed:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?l
WHERE { ?s rdfs:label ?l }
Now I've made an example with rdfs and I hope it's simple enough and
that it makes sense. In practice, I'd like to have a list of prefixes,
even custom ones. My endgoal is that I can send queries without having
to define any PREFIX because they are automatically attached by the
server, at every request. If I need any particular prefix, or if I
need to override one of the default prefixes, than those will be
specified in the specific query.
Hope it makes sense, thank you.
Sent: Friday, September 03, 2021 at 8:35 AM
From: "Michael Wechner" <[email protected]>
To: [email protected]
Subject: Re: Fuseki: how can I inject standard prefixes to every query?
can you give an example?
Thanks
Michael