Advanced Graph Querying: Difference between revisions
(Created page with "== Property Paths == see also: https://en.wikibooks.org/wiki/SPARQL/Property_paths TODO for MemCP: * property/propertypath * propertypath*, propertypath+ (mark&sweep, then iterate over the results) * property? * (propertypath) * ^property (inverse path)") |
Wikiservice (talk | contribs) (Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference) |
||
| Line 1: | Line 1: | ||
<!-- Copyright (C) 2026 Carl-Philip Haensch --> | |||
<!-- SPDX-License-Identifier: GPL-3.0-or-later --> | |||
= Advanced Graph Querying = | |||
MemCP exposes its tested SPARQL subset at <code>/rdf/<database></code>. Queries can combine triple patterns, FILTER expressions, OPTIONAL blocks, bindings, and supported update forms. Turtle data can be loaded through <code>/rdf/<database>/load_ttl</code>. | |||
<syntaxhighlight lang="sparql"> | |||
SELECT ?person ?name WHERE { | |||
?person <http://xmlns.com/foaf/0.1/name> ?name . | |||
OPTIONAL { ?person <http://example.org/active> ?active . } | |||
* | FILTER(!BOUND(?active) || ?active = true) | ||
} | |||
</syntaxhighlight> | |||
Update templates include tested DELETE/INSERT/WHERE forms. RDF literals and IRIs must use the supported escaping rules; application input must not be concatenated into query text without validation. | |||
This page documents a tested subset, not complete SPARQL standard conformance or a separate general-purpose graph execution engine. Add successful and must-fail integration tests before advertising another construct. See [[Introduction to RDF]] and [[SQL over REST]]. | |||
== Property-path roadmap == | |||
SPARQL property paths remain a planned extension. The intended progression covers one-step alternatives/sequences, inverse paths, optional paths and transitive <code>*</code>/<code>+</code> traversal. Recursive traversal needs explicit visited-set semantics, cancellation, bounds and a physical representation that does not repeatedly materialize the same nodes. Until tests and documentation say otherwise, do not assume property-path syntax is accepted. | |||
Revision as of 11:59, 28 August 2026
Advanced Graph Querying
MemCP exposes its tested SPARQL subset at /rdf/<database>. Queries can combine triple patterns, FILTER expressions, OPTIONAL blocks, bindings, and supported update forms. Turtle data can be loaded through /rdf/<database>/load_ttl.
<syntaxhighlight lang="sparql"> SELECT ?person ?name WHERE {
?person <http://xmlns.com/foaf/0.1/name> ?name . OPTIONAL { ?person <http://example.org/active> ?active . } FILTER(!BOUND(?active) || ?active = true)
} </syntaxhighlight>
Update templates include tested DELETE/INSERT/WHERE forms. RDF literals and IRIs must use the supported escaping rules; application input must not be concatenated into query text without validation.
This page documents a tested subset, not complete SPARQL standard conformance or a separate general-purpose graph execution engine. Add successful and must-fail integration tests before advertising another construct. See Introduction to RDF and SQL over REST.
Property-path roadmap
SPARQL property paths remain a planned extension. The intended progression covers one-step alternatives/sequences, inverse paths, optional paths and transitive */+ traversal. Recursive traversal needs explicit visited-set semantics, cancellation, bounds and a physical representation that does not repeatedly materialize the same nodes. Until tests and documentation say otherwise, do not assume property-path syntax is accepted.