Re: to navigate the whole network to the end of all branches and nodes by SPARQL

Hi Lei,

The following query will include the score in the results for you. You
may also want to move the DISTINCT into a subquery. If many ?person have
reviewed many ?product it would be more efficient to reduce the ?person
results earlier. Both changes are show below.

Also, what semantic engines are you working with?

PREFIX rev: <http://dbpedia.org/review/>
PREFIX pd: <http://dbpedia.org/product/>
PREFIX pe: <http://dbpedia.org/person/>

SELECT ?person ?score ?product  WHERE
{
  {
    SELECT DISTINCT ?person {
      pd:01 ^(rev:5|rev:4)/((rev:5|rev:4)/^(rev:5|rev:4))* ?person.
    }
  }
  {
    ?person rev:5 ?product
    BIND (5 AS ?score)
  } UNION {
    ?person rev:4 ?product
    BIND (4 AS ?score)
  }
}

Regards,
James

Received on Friday, 11 July 2014 14:17:57 UTC