- Created PlantUML diagrams for custodian types, full schema, legal status, and organizational structure. - Implemented a script to generate GraphViz DOT diagrams from OWL/RDF ontology files. - Developed a script to generate UML diagrams from modular LinkML schema, supporting both Mermaid and PlantUML formats. - Enhanced class definitions and relationships in UML diagrams to reflect the latest schema updates.
339 lines
9.1 KiB
Markdown
339 lines
9.1 KiB
Markdown
# EncompassingBody RDF and UML Generation Complete
|
|
|
|
**Date**: 2025-11-23
|
|
**Timestamp**: 20251123_225622 (RDF), 20251123_225712 (UML)
|
|
**Status**: ✅ COMPLETE
|
|
|
|
---
|
|
|
|
## Generated Files
|
|
|
|
### RDF Formats (6 formats)
|
|
|
|
All generated with timestamp `20251123_225622`:
|
|
|
|
1. **OWL/Turtle** - `EncompassingBody_20251123_225622.owl.ttl` (11K)
|
|
- Primary OWL ontology in Turtle syntax
|
|
- Contains class definitions, properties, restrictions
|
|
- Includes ontology mappings (org:, schema:, skos:)
|
|
|
|
2. **N-Triples** - `EncompassingBody_20251123_225622.nt` (36K)
|
|
- Simple triple format for easy parsing
|
|
- One triple per line
|
|
|
|
3. **RDF/XML** - `EncompassingBody_20251123_225622.rdf` (29K)
|
|
- XML serialization of RDF
|
|
- Compatible with legacy RDF tools
|
|
|
|
4. **N3** - `EncompassingBody_20251123_225622.n3` (11K)
|
|
- Notation3 format (superset of Turtle)
|
|
|
|
5. **TriG** - `EncompassingBody_20251123_225622.trig` (16K)
|
|
- Named graphs extension of Turtle
|
|
|
|
6. **TriX** - `EncompassingBody_20251123_225622.trix` (60K)
|
|
- XML-based RDF format with named graphs
|
|
|
|
**Location**: `/schemas/20251121/rdf/`
|
|
|
|
---
|
|
|
|
### UML/Mermaid Diagrams (4 class diagrams)
|
|
|
|
All generated with timestamp `20251123_225712`:
|
|
|
|
1. **EncompassingBody** - `EncompassingBody_20251123_225712.mmd` (1.2K)
|
|
- Abstract parent class diagram
|
|
- Shows inheritance hierarchy (3 subclasses)
|
|
- Displays all slots/properties
|
|
- Links to EncompassingBodyTypeEnum
|
|
|
|
2. **UmbrellaOrganisation** - `UmbrellaOrganisation_20251123_225712.mmd` (1.1K)
|
|
- Legal parent organization class diagram
|
|
- Inherits from EncompassingBody
|
|
- Mapped to org:FormalOrganization
|
|
|
|
3. **NetworkOrganisation** - `NetworkOrganisation_20251123_225712.mmd` (1.1K)
|
|
- Service provider network class diagram
|
|
- Inherits from EncompassingBody
|
|
- Mapped to schema:Organization
|
|
|
|
4. **Consortium** - `Consortium_20251123_225712.mmd` (955B)
|
|
- Mutual assistance body class diagram
|
|
- Inherits from EncompassingBody
|
|
- Mapped to schema:Consortium
|
|
|
|
**Location**: `/schemas/20251121/uml/mermaid/`
|
|
|
|
---
|
|
|
|
## RDF Ontology Content
|
|
|
|
### Classes Defined
|
|
|
|
1. **EncompassingBody** (abstract)
|
|
- `class_uri: org:Organization`
|
|
- Parent class for all encompassing body types
|
|
|
|
2. **UmbrellaOrganisation**
|
|
- `class_uri: org:FormalOrganization`
|
|
- `skos:exactMatch schema:GovernmentOrganization`
|
|
- Legal parent organizations
|
|
|
|
3. **NetworkOrganisation**
|
|
- `class_uri: schema:Organization`
|
|
- Service provider networks
|
|
|
|
4. **Consortium**
|
|
- `class_uri: schema:Consortium`
|
|
- Peer-to-peer mutual assistance bodies
|
|
|
|
### Properties Defined
|
|
|
|
| Property | Slot URI | Range | Cardinality |
|
|
|----------|----------|-------|-------------|
|
|
| `id` | (identifier) | uriorcurie | 1..1 (required) |
|
|
| `organization_name` | `skos:prefLabel` | string | 1..1 (required) |
|
|
| `organization_type` | - | EncompassingBodyTypeEnum | 1..1 (required) |
|
|
| `description` | - | string | 0..1 |
|
|
| `legal_form` | `org:classification` | string | 0..1 (required for Umbrella) |
|
|
| `founding_date` | `schema:foundingDate` | date | 0..1 |
|
|
| `dissolution_date` | `schema:dissolutionDate` | date | 0..1 |
|
|
| `member_custodians` | `org:hasSubOrganization` | string | 0..* |
|
|
| `governance_authority` | - | string | 0..1 (required for Umbrella) |
|
|
| `service_offerings` | - | string | 0..* (required for Network/Consortium) |
|
|
| `membership_criteria` | - | string | 0..1 |
|
|
| `identifiers` | `dcterms:identifier` | string | 0..* |
|
|
| `website` | `schema:url` | uri | 0..1 |
|
|
|
|
### Enumeration
|
|
|
|
**EncompassingBodyTypeEnum**:
|
|
- `UMBRELLA` → `org:FormalOrganization`
|
|
- `NETWORK` → `schema:Organization`
|
|
- `CONSORTIUM` → `schema:Consortium`
|
|
|
|
---
|
|
|
|
## OWL Restrictions
|
|
|
|
Each subclass has OWL restrictions enforcing required fields:
|
|
|
|
### UmbrellaOrganisation
|
|
- `governance_authority`: minCardinality 1 (required)
|
|
- `legal_form`: minCardinality 1 (required)
|
|
|
|
### NetworkOrganisation
|
|
- `service_offerings`: minCardinality 1 (required, multivalued)
|
|
|
|
### Consortium
|
|
- No additional restrictions (inherits from EncompassingBody)
|
|
|
|
---
|
|
|
|
## Mermaid Diagram Features
|
|
|
|
Each diagram includes:
|
|
|
|
✅ **Inheritance hierarchy** - Shows `<|--` relationship to parent class
|
|
✅ **Properties list** - All slots displayed on class
|
|
✅ **Relationship to enums** - Links to EncompassingBodyTypeEnum
|
|
✅ **Clickable links** - Navigate between related classes (in web view)
|
|
|
|
### Example: EncompassingBody Hierarchy
|
|
|
|
```mermaid
|
|
classDiagram
|
|
class EncompassingBody
|
|
EncompassingBody <|-- UmbrellaOrganisation
|
|
EncompassingBody <|-- NetworkOrganisation
|
|
EncompassingBody <|-- Consortium
|
|
|
|
EncompassingBody : id
|
|
EncompassingBody : organization_name
|
|
EncompassingBody : organization_type
|
|
EncompassingBody : description
|
|
EncompassingBody : legal_form
|
|
EncompassingBody : founding_date
|
|
EncompassingBody : dissolution_date
|
|
EncompassingBody : member_custodians
|
|
EncompassingBody : governance_authority
|
|
EncompassingBody : service_offerings
|
|
EncompassingBody : membership_criteria
|
|
EncompassingBody : identifiers
|
|
EncompassingBody : website
|
|
|
|
EncompassingBody --> "1" EncompassingBodyTypeEnum : organization_type
|
|
```
|
|
|
|
---
|
|
|
|
## Generation Process
|
|
|
|
### Step 1: Create Standalone Schema
|
|
|
|
Created `/tmp/EncompassingBody_standalone.yaml` with:
|
|
- Self-contained schema (no external dependencies)
|
|
- Inline enum definitions
|
|
- Simplified ranges (string instead of complex types)
|
|
- All necessary prefixes
|
|
|
|
### Step 2: Generate RDF with gen-owl
|
|
|
|
```bash
|
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
gen-owl -f ttl /tmp/EncompassingBody_standalone.yaml \
|
|
> schemas/20251121/rdf/EncompassingBody_${TIMESTAMP}.owl.ttl
|
|
```
|
|
|
|
**Output**: OWL/Turtle (11K, 284 lines)
|
|
|
|
### Step 3: Convert to Other RDF Formats with rdfpipe
|
|
|
|
```bash
|
|
rdfpipe EncompassingBody_${TIMESTAMP}.owl.ttl -o nt > ...nt
|
|
rdfpipe EncompassingBody_${TIMESTAMP}.owl.ttl -o xml > ...rdf
|
|
rdfpipe EncompassingBody_${TIMESTAMP}.owl.ttl -o n3 > ...n3
|
|
rdfpipe EncompassingBody_${TIMESTAMP}.owl.ttl -o trig > ...trig
|
|
rdfpipe EncompassingBody_${TIMESTAMP}.owl.ttl -o trix > ...trix
|
|
```
|
|
|
|
**Note**: JSON-LD plugin not available in current rdflib installation
|
|
|
|
### Step 4: Generate Mermaid Diagrams with gen-mermaid-class-diagram
|
|
|
|
```bash
|
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
gen-mermaid-class-diagram -d /tmp/mermaid_out_${TIMESTAMP} \
|
|
/tmp/EncompassingBody_standalone.yaml
|
|
```
|
|
|
|
**Output**: 4 Mermaid diagrams (one per class)
|
|
|
|
### Step 5: Copy with Timestamps
|
|
|
|
Copied all generated files to schema directories with full timestamps in filenames.
|
|
|
|
---
|
|
|
|
## Ontology Mappings in RDF
|
|
|
|
### EncompassingBody
|
|
```turtle
|
|
<hc:EncompassingBody> a owl:Class ;
|
|
rdfs:label "EncompassingBody" ;
|
|
skos:exactMatch org:Organization .
|
|
```
|
|
|
|
### UmbrellaOrganisation
|
|
```turtle
|
|
<hc:UmbrellaOrganisation> a owl:Class ;
|
|
rdfs:label "UmbrellaOrganisation" ;
|
|
rdfs:subClassOf <hc:EncompassingBody> ;
|
|
skos:exactMatch org:FormalOrganization .
|
|
```
|
|
|
|
### NetworkOrganisation
|
|
```turtle
|
|
<hc:NetworkOrganisation> a owl:Class ;
|
|
rdfs:label "NetworkOrganisation" ;
|
|
rdfs:subClassOf <hc:EncompassingBody> ;
|
|
skos:exactMatch schema:Organization .
|
|
```
|
|
|
|
### Consortium
|
|
```turtle
|
|
<hc:Consortium> a owl:Class ;
|
|
rdfs:label "Consortium" ;
|
|
rdfs:subClassOf <hc:EncompassingBody> ;
|
|
skos:exactMatch schema:Consortium .
|
|
```
|
|
|
|
---
|
|
|
|
## File Sizes Summary
|
|
|
|
### RDF Files (Total: ~163K)
|
|
- OWL/Turtle: 11K (284 lines)
|
|
- N-Triples: 36K (largest - verbose format)
|
|
- RDF/XML: 29K
|
|
- N3: 11K (compact)
|
|
- TriG: 16K
|
|
- TriX: 60K (verbose XML)
|
|
|
|
### Mermaid Files (Total: ~4.3K)
|
|
- EncompassingBody: 1.2K (52 lines)
|
|
- UmbrellaOrganisation: 1.1K
|
|
- NetworkOrganisation: 1.1K
|
|
- Consortium: 955B
|
|
|
|
---
|
|
|
|
## Validation
|
|
|
|
### RDF Validation
|
|
✅ Successfully parsed by rdfpipe (no syntax errors)
|
|
✅ Multiple serialization formats generated without errors
|
|
✅ OWL restrictions properly defined
|
|
✅ SKOS mappings included for interoperability
|
|
|
|
### UML Validation
|
|
✅ Valid Mermaid syntax
|
|
✅ Inheritance hierarchy correctly displayed
|
|
✅ All properties listed on parent class
|
|
✅ Clickable links for web rendering
|
|
|
|
---
|
|
|
|
## Usage Examples
|
|
|
|
### Loading RDF into Triple Store
|
|
|
|
```bash
|
|
# Load into Apache Jena Fuseki
|
|
curl -X POST \
|
|
--data-binary @EncompassingBody_20251123_225622.owl.ttl \
|
|
-H "Content-Type: text/turtle" \
|
|
http://localhost:3030/dataset/data
|
|
```
|
|
|
|
### Rendering Mermaid Diagram
|
|
|
|
```markdown
|
|
<!-- In Markdown file -->
|
|

|
|
```
|
|
|
|
Or in GitHub/GitLab:
|
|
```markdown
|
|
```mermaid
|
|
[contents of .mmd file]
|
|
```
|
|
```
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
1. **Integrate with Main Schema**: Import EncompassingBody into main custodian schema
|
|
2. **Add to Documentation**: Include diagrams in schema documentation
|
|
3. **SPARQL Queries**: Create example SPARQL queries using generated ontology
|
|
4. **Validation Rules**: Add SHACL shapes for data validation
|
|
5. **JSON-LD Context**: Create JSON-LD context file (when plugin available)
|
|
|
|
---
|
|
|
|
## Files Modified/Generated
|
|
|
|
**Generated**:
|
|
- 6 RDF files in `/schemas/20251121/rdf/`
|
|
- 4 Mermaid diagrams in `/schemas/20251121/uml/mermaid/`
|
|
- Standalone LinkML schema in `/tmp/` (temporary)
|
|
|
|
**Total**: 10 files (~167K)
|
|
|
|
---
|
|
|
|
**Generation Status**: ✅ COMPLETE
|
|
**All formats have proper timestamps**: ✅ YES
|
|
**Ready for integration**: ✅ YES
|