Path Expression¶
A structured-data query expression that composes navigation steps to select nodes or values under a language's tree or graph semantics.
Core Idea¶
A path expression tells a query how to reach data through named or typed steps. The steps operate on a structured data model, such as an XML tree or an RDF graph. A context node or subject/object positions give the language a place to interpret the path; those positions can include variables discovered during query matching. The expression describes a route pattern, while the actual data determines what nodes or values match it.[ref-3cee2124eace][ref-c10d9d0dac5b]
XPath 3.1 uses slash-separated tree steps. SPARQL 1.1 uses property paths between graph endpoints. Both compose relations, but their result, ordering, duplicate, and error rules belong to their own languages. A fixed known root, a filter, and repetition are not required in every path expression.[ref-3cee2124eace][ref-c10d9d0dac5b]
Scope of Application¶
In XML querying, child::div1/child::para selects para children of div1 children of the current context node. XPath can also begin a path at a document root, and it supports predicates within steps. When its slash operator returns nodes, XPath removes duplicate nodes and returns them in document order; other result types use different handling.[^ref-3cee2124eace]
In RDF querying, SPARQL's ?x foaf:knows/foaf:name ?name joins a knows predicate step to a name step. Its endpoint positions can be variables, and the graph can be cyclic. SPARQL also offers inverse, alternative, and repeated property paths, but a simple two-step sequence needs none of them. XPath's node-order guarantee is not a general SPARQL guarantee.[^ref-c10d9d0dac5b]
Clarity¶
Keep the written expression separate from the matched result. The expression fixes which relations to follow and in what order; the data may supply zero, one, or many matches. If a query returns an unexpected value, check the starting context or endpoint positions, the step order, and the host language's evaluation rules before assuming that the data contains the intended route.[ref-3cee2124eace][ref-c10d9d0dac5b]
The distinction also separates this entry from the live Prime Path. A Prime Path is one committed edge sequence. A path expression is a formal query construction that may match several routes or none. Its accepted DAG parent is Prime Relation as an internal semantic constituent: each navigation step needs a rule specifying which positions are related. The expression itself is not a Relation.
Manages Complexity¶
Composing steps gives a compact way to state a multi-relation query. SPARQL's specification translates :p/:q into two predicate edges linked through an intermediate variable; the slash form does not require the query writer to name that intermediate position. XPath's slash form similarly makes a tree route readable as a sequence of steps.[ref-3cee2124eace][ref-c10d9d0dac5b]
The compact form is easiest to debug when it is expanded back into the language's actual semantics. XPath has focus, node-order, duplicate, non-node, and error rules at the slash operator. SPARQL has graph-pattern and property-path rules. Shared path vocabulary does not make those detailed rules identical.[ref-3cee2124eace][ref-c10d9d0dac5b]
Abstract Reasoning¶
The useful structural move is to compose relations in order. The first step identifies possible intermediate positions; the next step applies at those positions. Swapping steps usually changes the query. A one-step path is still a path expression, though composition becomes visible when there are two or more steps.[ref-3cee2124eace][ref-c10d9d0dac5b]
This gives a simple counterfactual test: remove or change one step and ask which endpoints can still be selected. The test concerns the expression's meaning under a data model. It does not require a search frontier, a human navigator, or a previously realized path.
Knowledge Transfer¶
The same checklist helps read paths in different structured query languages: identify the data model, the context or endpoint positions, the ordered step relations, and the result rules. That transfers from XML tree queries to RDF graph queries while keeping each language's details in place.[ref-3cee2124eace][ref-c10d9d0dac5b]
The transfer stops at those shared roles. SPARQL's variable and cycle behavior is not an XPath rule, and XPath's document ordering is not a SPARQL promise. A road itinerary or an observed citation chain may be a path, but it is not a path expression in this query-language sense merely because it has ordered links.
Example¶
XPath's child::div1/child::para uses an XML tree (data model), a current node (context), the div1 then para child steps (ordered relations), and XPath's node-selection rules (evaluation). SPARQL's ?x foaf:knows/foaf:name ?name uses an RDF graph, two endpoint variable positions, the knows then name predicate steps, and SPARQL path-pattern matching. The cases have different data structures and result rules but the same step-composition roles.[ref-3cee2124eace][ref-c10d9d0dac5b]
Relationships to Other Abstractions¶
Current abstraction Path Expression Domain-specific
Parents (1) — more general patterns this builds on
-
Path Expression is part of Relation Prime
A path expression contains one or more language-defined navigation-step relations as identity-bearing semantic constituents.
Hierarchy path (1) — routes to 1 parentless root
- Path Expression → Relation
Neighborhood in Abstraction Space¶
Path Expression sits in a sparse region of the domain-specific corpus (96th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.
Family — Unclustered & Miscellaneous (2721 abstractions)
Nearest neighbors
- Semantic triple — 0.78
- Linked Open Data Release — 0.78
- Miller Columns — 0.77
- Nested Set Model — 0.77
- Codd's theorem — 0.76
Computed from structural-signature embeddings · 2026-10-17
Not to Be Confused With¶
Prime Path is an already specified edge sequence, and Network Traversal is a procedure with a frontier and visit policy. Query Rewriting changes a query into an equivalent form; a path expression is a form that can be evaluated without being rewritten. The phrase also has a separate process-synchronization meaning in concurrency research; that homonym is outside this entry.[^ref-ad84611c0d84]
The accepted DAG edge is domain_specific:path_expression → prime:relation, typed composition/part_of with the relation step inside the expression's meaning. It does not claim that all XPath slash operations are pure associative binary relation composition.[^ref-3cee2124eace]
References¶
[^ref-3cee2124eace]: W3C XML Query Working Group and XSLT Working Group, XML Path Language (XPath) 3.1, W3C Recommendation, 21 March 2017, §§3.3–3.3.5, especially §§3.3.1–3.3.1.1. https://www.w3.org/TR/2017/REC-xpath-31-20170321/ [^ref-c10d9d0dac5b]: W3C SPARQL Working Group, SPARQL 1.1 Query Language, W3C Recommendation, 21 March 2013, §§9.1–9.3 and 18.2.2.3–18.2.2.4. https://www.w3.org/TR/2013/REC-sparql11-query-20130321/ [^ref-ad84611c0d84]: Roy Harold Campbell, Path Expressions, A Technique for Specifying Process Synchronization, PhD thesis, Newcastle University, 1976. The repository prints a colon after “Expressions”; comma transcribed here for citation binding. Institutional repository metadata and abstract consulted for the homonym only; full thesis not inspected. https://theses.ncl.ac.uk/jspui/handle/10443/1973