How to express equals relation in sparql?
up vote
0
down vote
favorite
I am trying to use sparql to find all French labels of words that are related to a given English word.
The query I made is something like the following:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
While it does give me the French labels of the extword
as desired, it does not give the French labels of word
itself.
What I need is to insert a clause to express the relation that extword
is exactly word
, like this:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword = ?word}
UNION
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
It turns out to be syntax error. Is it possible to also include the French labels of word
itself, without doing another query?
To be clearer, the result I expect is the result from my first query combined with result from the following query:
SELECT ?word ?label where {
?word rdfs:label "shark"@eng.
?word rdfs:label ?label filter(lang(?label)="fra")
}
sparql rdfs
|
show 10 more comments
up vote
0
down vote
favorite
I am trying to use sparql to find all French labels of words that are related to a given English word.
The query I made is something like the following:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
While it does give me the French labels of the extword
as desired, it does not give the French labels of word
itself.
What I need is to insert a clause to express the relation that extword
is exactly word
, like this:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword = ?word}
UNION
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
It turns out to be syntax error. Is it possible to also include the French labels of word
itself, without doing another query?
To be clearer, the result I expect is the result from my first query combined with result from the following query:
SELECT ?word ?label where {
?word rdfs:label "shark"@eng.
?word rdfs:label ?label filter(lang(?label)="fra")
}
sparql rdfs
UNION clauses are executed independently from each other. That's why this can't work. The solution is to use a FILTER besides the UNION pattern, i.e.SELECT ?extword ?word ?label where { ?word rdfs:label "shark"@eng. {?extword rdf:type ?word} UNION {?word rdf:type ?extword}. ?extword rdfs:label ?label filter(lang(?label)="fra") } FILTER(?extword = ?word)}
Indeed, this query might be wrong because for me the whole query isn't clear so far.
– AKSW
Nov 19 at 7:35
What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
Nov 19 at 7:38
Something like?extword rdf:type|^rdf:type ?word
could be also used in your query to simplify it
– AKSW
Nov 19 at 7:42
@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
Nov 19 at 7:59
The expected result are the French labels of all theextword
as well as that of theword
. The result of my original query are only the labels ofextword
.
– NGY
Nov 19 at 8:04
|
show 10 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to use sparql to find all French labels of words that are related to a given English word.
The query I made is something like the following:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
While it does give me the French labels of the extword
as desired, it does not give the French labels of word
itself.
What I need is to insert a clause to express the relation that extword
is exactly word
, like this:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword = ?word}
UNION
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
It turns out to be syntax error. Is it possible to also include the French labels of word
itself, without doing another query?
To be clearer, the result I expect is the result from my first query combined with result from the following query:
SELECT ?word ?label where {
?word rdfs:label "shark"@eng.
?word rdfs:label ?label filter(lang(?label)="fra")
}
sparql rdfs
I am trying to use sparql to find all French labels of words that are related to a given English word.
The query I made is something like the following:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
While it does give me the French labels of the extword
as desired, it does not give the French labels of word
itself.
What I need is to insert a clause to express the relation that extword
is exactly word
, like this:
SELECT ?extword ?word ?label where {
?word rdfs:label "shark"@eng.
{?extword = ?word}
UNION
{?extword rdf:type ?word}
UNION
{?word rdf:type ?extword}.
?extword rdfs:label ?label filter(lang(?label)="fra")
}
It turns out to be syntax error. Is it possible to also include the French labels of word
itself, without doing another query?
To be clearer, the result I expect is the result from my first query combined with result from the following query:
SELECT ?word ?label where {
?word rdfs:label "shark"@eng.
?word rdfs:label ?label filter(lang(?label)="fra")
}
sparql rdfs
sparql rdfs
edited Nov 19 at 8:13
asked Nov 19 at 7:04
NGY
1437
1437
UNION clauses are executed independently from each other. That's why this can't work. The solution is to use a FILTER besides the UNION pattern, i.e.SELECT ?extword ?word ?label where { ?word rdfs:label "shark"@eng. {?extword rdf:type ?word} UNION {?word rdf:type ?extword}. ?extword rdfs:label ?label filter(lang(?label)="fra") } FILTER(?extword = ?word)}
Indeed, this query might be wrong because for me the whole query isn't clear so far.
– AKSW
Nov 19 at 7:35
What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
Nov 19 at 7:38
Something like?extword rdf:type|^rdf:type ?word
could be also used in your query to simplify it
– AKSW
Nov 19 at 7:42
@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
Nov 19 at 7:59
The expected result are the French labels of all theextword
as well as that of theword
. The result of my original query are only the labels ofextword
.
– NGY
Nov 19 at 8:04
|
show 10 more comments
UNION clauses are executed independently from each other. That's why this can't work. The solution is to use a FILTER besides the UNION pattern, i.e.SELECT ?extword ?word ?label where { ?word rdfs:label "shark"@eng. {?extword rdf:type ?word} UNION {?word rdf:type ?extword}. ?extword rdfs:label ?label filter(lang(?label)="fra") } FILTER(?extword = ?word)}
Indeed, this query might be wrong because for me the whole query isn't clear so far.
– AKSW
Nov 19 at 7:35
What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
Nov 19 at 7:38
Something like?extword rdf:type|^rdf:type ?word
could be also used in your query to simplify it
– AKSW
Nov 19 at 7:42
@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
Nov 19 at 7:59
The expected result are the French labels of all theextword
as well as that of theword
. The result of my original query are only the labels ofextword
.
– NGY
Nov 19 at 8:04
UNION clauses are executed independently from each other. That's why this can't work. The solution is to use a FILTER besides the UNION pattern, i.e.
SELECT ?extword ?word ?label where { ?word rdfs:label "shark"@eng. {?extword rdf:type ?word} UNION {?word rdf:type ?extword}. ?extword rdfs:label ?label filter(lang(?label)="fra") } FILTER(?extword = ?word)}
Indeed, this query might be wrong because for me the whole query isn't clear so far.– AKSW
Nov 19 at 7:35
UNION clauses are executed independently from each other. That's why this can't work. The solution is to use a FILTER besides the UNION pattern, i.e.
SELECT ?extword ?word ?label where { ?word rdfs:label "shark"@eng. {?extword rdf:type ?word} UNION {?word rdf:type ?extword}. ?extword rdfs:label ?label filter(lang(?label)="fra") } FILTER(?extword = ?word)}
Indeed, this query might be wrong because for me the whole query isn't clear so far.– AKSW
Nov 19 at 7:35
What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
Nov 19 at 7:38
What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
Nov 19 at 7:38
Something like
?extword rdf:type|^rdf:type ?word
could be also used in your query to simplify it– AKSW
Nov 19 at 7:42
Something like
?extword rdf:type|^rdf:type ?word
could be also used in your query to simplify it– AKSW
Nov 19 at 7:42
@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
Nov 19 at 7:59
@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
Nov 19 at 7:59
The expected result are the French labels of all the
extword
as well as that of the word
. The result of my original query are only the labels of extword
.– NGY
Nov 19 at 8:04
The expected result are the French labels of all the
extword
as well as that of the word
. The result of my original query are only the labels of extword
.– NGY
Nov 19 at 8:04
|
show 10 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369768%2fhow-to-express-equals-relation-in-sparql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
UNION clauses are executed independently from each other. That's why this can't work. The solution is to use a FILTER besides the UNION pattern, i.e.
SELECT ?extword ?word ?label where { ?word rdfs:label "shark"@eng. {?extword rdf:type ?word} UNION {?word rdf:type ?extword}. ?extword rdfs:label ?label filter(lang(?label)="fra") } FILTER(?extword = ?word)}
Indeed, this query might be wrong because for me the whole query isn't clear so far.– AKSW
Nov 19 at 7:35
What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
Nov 19 at 7:38
Something like
?extword rdf:type|^rdf:type ?word
could be also used in your query to simplify it– AKSW
Nov 19 at 7:42
@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
Nov 19 at 7:59
The expected result are the French labels of all the
extword
as well as that of theword
. The result of my original query are only the labels ofextword
.– NGY
Nov 19 at 8:04