Advanced Graph Querying

From MemCP
Revision as of 11:59, 28 August 2026 by Wikiservice (talk | contribs) (Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference)
Jump to navigation Jump to search

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.