This discussion is archived
1 Reply Latest reply: Aug 11, 2011 9:57 AM by alwu RSS

Do we have Joins  , Intersection in SPARQL

880207 Newbie
Currently Being Moderated
Hi,

In our SQL we have OUTER / INNER JOINS, is there anything similar in SPARQL?
Also i found UNION in SPARQL, Do we have INTERSECTION in SPARQL?

Thanks and Regards,
Manish H
  • 1. Re: Do we have Joins  , Intersection in SPARQL
    alwu Pro
    Currently Being Moderated
    Hi,

    In a BGP, patterns are joined together. SPARQL OPTIONAL is similar to outer join.

    Say you have a query pattern ?x :friendOf :John, and you want to do an intersection
    with query pattern ?x :friendOf :Mary, an easy way is to put these two patterns together.

    { ?x  :friendOf   :John .  ?x  :friendOf   :Mary .}

    The following SPEC has all the information you need for SPARQL 1.0.
    http://www.w3.org/TR/rdf-sparql-query/

    Thanks,

    Zhe Wu

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points