W3C home > Mailing lists > Public > semantic-web@w3.org > July 2014

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

From: James Leigh <james@3roundstones.com>
Date: Fri, 11 Jul 2014 10:17:27 -0400
Message-ID: <1405088247.10744.12.camel@Wild-Dog>
To: Lei Xu <lei.xu@marklogic.com>
Cc: Semantic Web <semantic-web@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:49:17 UTC