Advanced Graph Querying: Difference between revisions

From MemCP
Jump to navigation Jump to search
(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)")
 
(Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Property Paths ==
<!-- Copyright (C) 2026 Carl-Philip Haensch -->
see also: https://en.wikibooks.org/wiki/SPARQL/Property_paths
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
= Advanced Graph Querying =


TODO for MemCP:
MemCP exposes its tested SPARQL subset at <code>/rdf/&lt;database&gt;</code>. Queries can combine triple patterns, FILTER expressions, OPTIONAL blocks, bindings, and supported update forms. Turtle data can be loaded through <code>/rdf/&lt;database&gt;/load_ttl</code>.


* property/propertypath
<pre>
* propertypath*, propertypath+ (mark&sweep, then iterate over the results)
SELECT ?person ?name WHERE {
* property?
  ?person <http://xmlns.com/foaf/0.1/name> ?name .
* (propertypath)
  OPTIONAL { ?person <http://example.org/active> ?active . }
* ^property (inverse path)
  FILTER(!BOUND(?active) || ?active = true)
}
</pre>
 
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.

Latest revision as of 12:13, 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.

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)
}

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.