SPARQL & Ontology¶
ThinkERD converts ERD structures into ontology (RDFS/OWL) in real time, enabling SPARQL queries for semantic analysis.
Overview¶
While standard SQL focuses on "how to store data," SPARQL focuses on "how to explore the relationships and meaning between data."
graph LR
ERD["📊 ERD Model"] -->|"R2RML conversion"| OWL["🌐 RDFS/OWL"]
OWL -->|"Load"| OX["🔍 Query Engine"]
OX -->|"SPARQL query"| R["📋 Results"] SQL vs SPARQL Comparison¶
| Aspect | SQL | SPARQL |
|---|---|---|
| Target | Table data | Ontology (semantic graph) |
| Question | "What is this data's value?" | "What is the relationship between these concepts?" |
| Strength | CRUD, aggregation | Semantic exploration, structural analysis |
| ThinkERD usage | Mock data analysis | Analyzing the ERD structure itself |
ERD → Ontology Mapping¶
ERD structural elements are automatically converted to ontology concepts:
| ERD | Ontology | Description |
|---|---|---|
| Entity | owl:Class | Class definition |
| Column | owl:DatatypeProperty | Data property |
| PK | owl:FunctionalProperty | Functional property (ensures uniqueness) |
| Relationship (FK) | owl:ObjectProperty | Object relationship |
| Subtype | rdfs:subClassOf | Class inheritance |
Using the SPARQL Scratchpad¶
Select the SPARQL tab in Data Lab to open the SPARQL editor.
Basic Query Examples¶
Practical Analysis Scenarios¶
Determine which other entities are affected when a specific entity changes.
Find "isolated" entities that have no relationships with any other entity.
Model Explorer¶
The Model Explorer in the global right-side inspector panel lets you browse the current diagram's ontology structure in a tree format.
- View class (entity) hierarchy structure
- View property (column) lists
- View relationship (FK) structure
- Use as vocabulary reference when writing SPARQL queries
New to SPARQL?
Don't worry if you're unfamiliar with SPARQL. Check the entity and attribute structure in the Model Explorer, then copy the example queries above and just change the entity names. Gradually modify queries to become comfortable with graph querying.