Work / Demonstration · SPARQL 1.1

Knowledge Graph Querying · BFO 2020 + RO

SPARQL Playground: querying BFO-aligned knowledge graphs

When processes, equipment, materials, and time intervals share a formal upper ontology like Basic Formal Ontology (BFO 2020), a single SPARQL 1.1 query can trace material handoffs, isolate shift participants, and audit unaligned records without brittle table joins.

Sample graph (sample_bfo.ttl)

A synthetic PV production line in BFO 2020 and OBO RO

The playground loads an in-memory RDFLib graph representing two manufacturing processes — ex:lamination-310 (Shift A) and ex:el-inspection-88 (Shift B) — plus two intentionally unaligned records for audit queries.

Continuants & materials

ex:cell-batch-17, ex:encapsulant-4, ex:module-0042, ex:laminator-2, and ex:el-camera-1 are typed under obo:BFO_0000040 (material entity).

Processes & temporal regions

ex:lamination-310 and ex:el-inspection-88 link to ex:shift-a and ex:shift-b via obo:BFO_0000199 (occupies temporal region) and trace inputs/outputs with obo:RO_0002233 and obo:RO_0002234.

Records needing cleanup

ex:supplier-note-7 is typed as ex:Note (not aligned to BFO) and ex:module-0043 has no rdf:type at all — ideal targets for governance queries.

Three built-in queries

Template queries included in the playground

Each template demonstrates a common engineering pattern: property-path traversal over BFO classes, multi-hop process lineage, and negative-pattern auditing with FILTER NOT EXISTS.

1. Continuants during a shift

Finds every continuant (rdf:type/rdfs:subClassOf* obo:BFO_0000002) that participated in a process occupying ex:shift-a.

SELECT ?continuant ?label ?process WHERE {
  ?process obo:BFO_0000199 ex:shift-a ;
           obo:BFO_0000057 ?continuant .
  ?continuant rdf:type/rdfs:subClassOf* obo:BFO_0000002 ;
              rdfs:label ?label .
} ORDER BY ?label

2. Trace process inputs to outputs

Follows material from ex:lamination-310 into ex:module-0042 and onward into ex:el-inspection-88 via OPTIONAL chaining.

SELECT ?process ?input ?output ?nextProcess WHERE {
  ?process obo:RO_0002233 ?input ;
           obo:RO_0002234 ?output .
  OPTIONAL { ?nextProcess obo:RO_0002233 ?output }
} ORDER BY ?process ?input

3. Entities not aligned to BFO

Surfaces ex:supplier-note-7 and ex:module-0043 — individuals whose class hierarchy never reaches obo:BFO_0000001.

SELECT DISTINCT ?thing ?label WHERE {
  ?thing rdfs:label ?label .
  FILTER(STRSTARTS(STR(?thing), STR(ex:)))
  FILTER NOT EXISTS { ?thing rdfs:subClassOf ?any }
  FILTER NOT EXISTS { ?thing rdf:type/rdfs:subClassOf* obo:BFO_0000001 }
} ORDER BY ?thing

Apply SPARQL to your own graph

We design BFO/CCO-aligned schemas and deterministic SPARQL query layers for engineering traceability, compliance audits, and Ontology-Augmented Generation (OAG).

Scope & limits

  • Synthetic graph: all ex: entities, processes, and shifts in sample_bfo.ttl are invented for demonstration.
  • Browser execution: RDFLib executes SPARQL 1.1 queries locally in WebAssembly; no data leaves your browser.
  • No OWL reasoner: queries rely on explicit rdfs:subClassOf* property paths rather than full OWL 2 DL materialization.