Regarding the following SPARQL federated query statements:
- There are over 10000
?s2related to?s1 - There are over 10000
?s3related to the previously found?s2 - There are over 10000
?s4related to the previously found?s3 - There are over 100
?s5related to the previously found?s4 - There are over 100
?s6related to the previously found?s5
Now I am using Jena to execute this SPARQL federated query statement, and the query has not ended.
With multiple SERVICE clauses and large numbers of relationships in the path, how to execute SPARQL federated query statement?
SELECT *
WHERE {
SERVICE <endpoint_1> {
?s1 <p_1> ?s2 .
FILTER ( ?s1 = <s_1> )
}
SERVICE <endpoint_2> {
?s2 <p_2> ?s3 .
}
SERVICE <endpoint_3> {
?s3 <p_3> ?s4 .
}
SERVICE <endpoint_4> {
?s4 <p_4> ?s5 .
}
SERVICE <endpoint_5> {
?s5 <p_5> ?s6 .
}
}
LIMIT 100
This is a reference information: when I import these triples into the same Virtuoso, removing the SERVICE clause can get the correct results:
SELECT *
WHERE {
?s1 <p_1> ?s2 .
FILTER ( ?s1 = <s_1> )
?s2 <p_2> ?s3 .
?s3 <p_3> ?s4 .
?s4 <p_4> ?s5 .
?s5 <p_5> ?s6 .
}
LIMIT 100