I've got this SPARQL query between 2 DBpedia resources: France and Alstom
select * where{
<http://dbpedia.org/resource/France> ?pre ?obj.
?obj ?pre1 <http://dbpedia.org/resource/Alstom>
}
and it returns nothing
but if I reverse the subject and the object like this:
select * where{
<http://dbpedia.org/resource/Alstom> ?pre ?obj.
?obj ?pre1 <http://dbpedia.org/resource/France>
}
the query returns some results..
is there any way to merge the two queries using UNION?
Based on your comment, you just need a straightforward union with the following syntax:
prefix dbpedia: <http://dbpedia.org/resource/>
select * where{
{
dbpedia:France ?pre ?obj.
?obj ?pre1 dbpedia:Alstom.
}
Union {
dbpedia:Alstom ?pre ?obj.
?obj ?pre1 dbpedia:France
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.