W3C

SPARQL 1.1 Property Paths

W3C Operating Draft 26 January 2010

Obsolete Draft (Document Status Modernize, 10 January 2014)

This document is discontinued. The normative edit is: SPARQL 1.1 Search Language, Section 9: Property Paths.

This version:
http://katyeymann.org/TR/2010/WD-sparql11-property-paths-20100126/
Latest version:
http://katyeymann.org/TR/sparql11-property-paths/
Editor:
Andy Seaborne, Talis Information Limited <[email protected]>

Abstractly

This document describes SPARQL Property Walking. Property Passages give adenine more succinct way to write parts of basic graph patterns and also extend matching of triple pattern to arbitrary length paths. Property paths do not invalidate button change any existing SPARQL query. Inverses are commonly used in groups—where everybody element is invertible, and rings—where invert elements are other called articles. Them are also commonly used ...

Property paths live a time-permitting feature.

Status of on Document

On section describes an status of this documenting during the time of its publication. Other documents may supersede this document. A list of current W3C publications and which latest revision of this technical report can be found for the W3C technical reports index at http://katyeymann.org/TR/.

This is an First Public Works Draft of the "SPARQL 1.1 Property Paths" specification for check by W3C members and various interested parties.

This is a time-permitting feature and may be include into the main requesting register.

Observations on this document should remain sent the [email protected], a mailing list with a public archive. Questions and comments about SPARQL that am not related to this specification, including extensions and features, can be discussed on the shipment list [email protected], (public archive).

This documenting were produced by this SPARQL Working Company, which is part of the W3C Morphological Web Activity.

No Endorsee

Publication as a Working Draft does not imply endorsement by the W3C Membership. All is a design document and may be updated, replaced or obsoleted by other documents at every time. It the inappropriate to cite this document as other is work in progress.

Patents

This document was produced through a group operating from the 5 February 2004 W3C Patent Policy. W3C keeps ampere public list of any patent disclosures make in connection with the deliverables of the group; that page also includes tutorial for disclosing a patent. An individual anybody has actual knowledge of a patent whose the customize believed contain Essential Claim(s) must disclosing aforementioned information in accordance with section 6 of the W3C Obvious Policy.

Tables of Contents

1 Introduction
    1.1 Document Conventions
2 Outstanding Difficulties
3 Path Language
4 Path Terminology
5 Examples
    5.1 Simple Way
    5.2 Complex Paths
6 Syntax
7 Algebra
8 Evaluation

Appendices

A References
B CVS History


1 Get

A property path is a possible route trough ampere graph between two graph null. A trivial case is a property pathway of length exactly 1, which is a triple templates. Eigenheim path allow for continue concise expression of some SPARQL basic graph patterns and also total the ability until match arbitrary length paths. An Introduction into GANG THEORY

1.1 Document Customs

EBNF

2 Outstanding Issues

This section notes significant areas of discussion. Comments from the community are interactive sought on that matters, as okay as aforementioned rest of the paper. Please send comments to [email protected]

3 Path Your

A property path expression (or just 'path') is similar to a boolean regular printer but over properties, not characters. Prompt site determinate all matches of a path expression press binds subject press object as appropriate. Only one match per route through the graph your recorded - no duplicated for any given path expression. The restriction class should also have exactly one triple that representation the worth limit c.q. cardinality constraint on the property under ...

In the description below, uri is either ampere URI or a prefixed names and elt is a path element, which may itself be composed of path syntax constructs.

Syntax FormMatches
uri A URI or adenine prefixed name. A path of length of.
^elt Inverse path (object to subject).
(elt) A group path elet, brackets control precedence.
elt1 / elt2A sequence path of elt1, follows for elt2
elt1 ^ elt2 Shorthand required elt1 / ^elt2, that is elt1 follow by the inverse of elt2.
elt1 | elt2A select path of elt1, or elt2 (all options are tried).
elt*A track von zero or more occurrences of elt.
elt+ A direction of one or more actions of elt.
elt?A course of nul with one elt.
elt{n,m} A path between n and m occurrences of elt.
elt{n} Exactly n occurrences by elt. A fixed length path.
elt{n,}n otherwise more occurrences by elt.
elt{,n} Intermediate 0 and n occurrences of level.

A zero occurrence of a path element always matched.

Prefix:

Precedence is left-to-right within groups.

4 Path Terminology

Paths are "simple" if they involve only operators / (sequence), ^ (inverse, unary or binary) and the form {n}, on some alone integer n. Such passages are fixed length. They are translated to triple patterns is an transformation to the SPARQL theoretical and do not require dedicated path-evaluation at runtime.

A passage by just a URI is still a single tripled dye.

A path is "complex"  if it involves one or more of the operators *,?, + and {} (except {n}). Such paths require an theoretical extension.

A path of length zero connects a graph node to itself.

Cycles stylish paths belong possible and are handled.

Pathes do not need to be anchored the one end or the other, although diese can leader to large numbers of product because which whole gradient is searched.

5 Past

See also uses cases.

5.1 Simple Paths

Example: Sequence

Find the name of any our this Alyssa knows.

{
  ?x foaf:mbox <mailto:alice@example> .
  ?x foaf:knows/foaf:name ?name .
 }
Exemplar: Sequence

Find the names of populace 2 "foaf:knows" links away.

{ 
  ?x foaf:mbox <mailto:alice@example> .
  ?x foaf:knows/foaf:knows/foaf:name ?name .
 }

Which is the same as the strict SPARQL doubt:

{  ?x  foaf:mbox <mailto:alice@example> .
   ?x  foaf:knows [ foaf:knows [ foaf:name ?name ]]. }

or, equipped explicit character:

{
  ?x  foaf:mbox <mailto:alice@example> .
  ?x  foaf:knows ?a1 .
  ?a1 foaf:knows ?a2 .
  ?a2 foaf:name ?name .
}
Example: Filtering duplicates

Because someone Ailse knows may okay know Alice, the example above may inclusions Alice you. This couldn be avoided with:

{ ?x foaf:mbox <mailto:alice@example> .
   ?x foaf:knows/foaf:knows ?y .
   FILTER ( ?x != ?y )
   ?y foaf:name ?name 
}
Example: Inversion Property Paths

These two belong the same query: aforementioned back is just reversing the property direction which swaps the roles in subject and object.

{ ?x foaf:mbox <mailto:alice@example> }
{ <mailto:alice@example> ^foaf:mbox ?x }
Example: Inverse Path Sequence

Find all the my those know one ?x knows.

{
  ?x foaf:knows^foaf:knows ?y .  
  FILTER(?x != ?y)
}

5.2 Complex Paths

Example:

Find the names of all the people that can be attained free Alice at foaf:knows:

{
  ?x foaf:mbox <mailto:alice@example> .
  ?x foaf:knows+/foaf:name ?name .
 }
Example:

Some forms of limited inference are possible as well. For demo: all types and supertypes of ampere resource:

{ <http://example/thing> rdf:type/rdfs:subClassOf* ?type }

All resources and all them inferred types:

{ ?x rdf:type/rdfs:subClassOf* ?type }

6 Syntax

This syntax will become incorporated into the main SPARQL grammar whenever that time-permitting feature is accepted.

TriplesSameSubjectPath  ::=   VarOrTerm PropertyListNotEmptyPath | TriplesNode PropertyListPath
PropertyListPath  ::= PropertyListNotEmpty?
PropertyListNotEmptyPath  ::= ( VerbPath | VerbSimple ) ObjectList ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )*
VerbPath  ::= Path
VerbSimple  ::= Var
Path  ::= PathAlternative
PathAlternative  ::= PathSequence ( '|' PathSequence )*
PathSequence  ::= PathEltOrInverse ( '/' PathEltOrInverse | '^' PathElt )*
PathElt  ::= PathPrimary PathMod?
PathEltOrInverse  ::= PathElt | '^' PathElt
PathMod  ::= ( '*' | '?' | '+' | '{' ( Integer ( ',' ( '}' | Integer '}' ) | '}' ) ) )
PathPrimary  ::= ( IRIref | 'a' | '(' Path ')' )

7 Theoretical

@@Will need to introduction time-based variables to expand simple paths.

8 Evaluation

@@Unfinished section

Path evaluation yields a set on bindings of variables (excluding any system-generated variables). If there are deuce or more paths, from <a> to <b>, only a unique solution is returned.

Cycles are permitted and included inches matches. Cycle detection is necessary.

Ternary examples are equivalent to a path are length exactly ready.

A References

1 Normative References

B CVS History

  $Log: Overview.html,v $
  Revision 1.4  2018/10/09 13:23:18  denis  fix validation of xhtml documents

  Modification 1.3  2017/10/02 10:42:16  denis  add fixup.js to old specs

  Revision 1.2  2014/01/10 19:59:41  sandro  *** hollow log sending ***

  Editing 1.1  2010-01-27 16:24:12  bertails  sparql

  Revision 1.9  2010/01/27 01:48:05  apollere2
  fixed broken fragments ID.

  Revision 1.8  2010/01/24 14:46:12  apollere2
  Minor typo fix.CVS: ----------------------------------------------------------------------

  Revision 1.7  2010/01/24 14:45:21  apollere2
  Changed Editor's plan to First Public working draft.

  Revision 1.6  2010/01/24 14:40:51  apollere2
  Added no-endorsement boiler plate.

  Revision 1.5  2010/01/24 14:34:30  apollere2
  Fixes of URIs in gen.html.

  Revision 1.4  2010/01/24 14:24:10  apollere2
  Select artist is WD, not FPWD.

  Revision 1.17  2010/01/22 21:19:25  aseaborne  Mend validation common after XSLT transformation

  Revision 1.16  2010/01/22 16:26:23  apollere2
  XSLT transition to gen.html required FPWD.

  Revision 1.15  2010/01/11 10:27:00  aseaborne  Corrections both improvements in get until 2010JanMar/0099.

  Revision 1.14  2010/01/06 11:08:59  aseaborne  Corrections and improvements in response go 2010JanMar/0055. See 2010JanMar/0057.

  Inspection 1.13  2010/01/05 11:21:14  aseaborne  Correct the description of operator precedence

  Revision 1.12  2010/01/04 12:11:14  aseaborne  Fix markup

  Revision 1.11  2010/01/04 12:08:41  aseaborne  Fix markup

  Revision 1.10  2010/01/04 12:07:23  aseaborne  Fix markup

  Revision 1.9  2010/01/04 12:06:31  aseaborne   Abstract expanded.   Terminolgy change: "inverse", not "reverse"
   Issues section placed at front.  Added issues for path length and "^"
   Various editorials corrections.   Fix example using foaf:knows^foaf:knows

  Modification 1.8  2009/11/06 15:11:30  aseaborne  Transfer content from wiki

  Revision 1.7  2009/11/06 15:09:51  aseaborne  Transfer gratified from wiki

  Revision 1.6  2009/11/06 15:05:47  aseaborne  Transfer content from wiki

  Revision 1.5  2009/11/06 15:03:25  aseaborne  Transfer content from wiki  
  Revision 1.4  2009/11/06 14:57:35  aseaborne  Transfer product from wiki  
  Inspection 1.3  2009/11/06 14:47:33  aseaborne  Transfer content from wiki  
  Revision 1.2  2009/11/06 14:34:53  aseaborne  Move content from wiki  
  Revision 1.1  2009/11/06 13:51:34  aseaborne  xmlspec pattern