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")
}









share|improve this question
























  • 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
    4 hours ago












  • What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
    – AKSW
    4 hours ago










  • Something like ?extword rdf:type|^rdf:type ?word could be also used in your query to simplify it
    – AKSW
    4 hours ago










  • @AKSW see linkeddata1.calcul.u-psud.fr/…
    – NGY
    3 hours ago










  • 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
    3 hours ago















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")
}









share|improve this question
























  • 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
    4 hours ago












  • What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
    – AKSW
    4 hours ago










  • Something like ?extword rdf:type|^rdf:type ?word could be also used in your query to simplify it
    – AKSW
    4 hours ago










  • @AKSW see linkeddata1.calcul.u-psud.fr/…
    – NGY
    3 hours ago










  • 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
    3 hours ago













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")
}









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 hours ago

























asked 4 hours ago









NGY

1436




1436












  • 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
    4 hours ago












  • What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
    – AKSW
    4 hours ago










  • Something like ?extword rdf:type|^rdf:type ?word could be also used in your query to simplify it
    – AKSW
    4 hours ago










  • @AKSW see linkeddata1.calcul.u-psud.fr/…
    – NGY
    3 hours ago










  • 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
    3 hours ago


















  • 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
    4 hours ago












  • What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
    – AKSW
    4 hours ago










  • Something like ?extword rdf:type|^rdf:type ?word could be also used in your query to simplify it
    – AKSW
    4 hours ago










  • @AKSW see linkeddata1.calcul.u-psud.fr/…
    – NGY
    3 hours ago










  • 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
    3 hours ago
















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
4 hours ago






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
4 hours ago














What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
4 hours ago




What I don't understand is the purpose of the query. Can you show some sample data + the expected result?
– AKSW
4 hours ago












Something like ?extword rdf:type|^rdf:type ?word could be also used in your query to simplify it
– AKSW
4 hours ago




Something like ?extword rdf:type|^rdf:type ?word could be also used in your query to simplify it
– AKSW
4 hours ago












@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
3 hours ago




@AKSW see linkeddata1.calcul.u-psud.fr/…
– NGY
3 hours ago












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
3 hours ago




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
3 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Volksrepublik China

How to test boost logger output in unit testing?

How do you send bulk inserts with no ids to elasticsearch