mdld-parse 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,107 @@
1
+ [prov] <http://www.w3.org/ns/prov#>
2
+ [my] <tag:alice@example.com,2026:>
3
+
4
+ # PROV-O Provenance Demo {=my:prov-demo .prov:Entity label}
5
+
6
+ Demonstrates complete provenance patterns using W3C PROV-O ontology.
7
+
8
+ ## Core PROV-O Classes
9
+
10
+ ### Entity Example {=my:report .prov:Entity label}
11
+
12
+ A report is an entity that exists and can be described.
13
+
14
+ Generated by: [Analysis Activity] {+my:analysis ?prov:wasGeneratedBy}
15
+ Attributed to: [Alice] {+my:alice .prov:Person ?prov:wasAttributedTo}
16
+ Derived from: [Raw Data] {+my:raw-data ?prov:wasDerivedFrom}
17
+
18
+ ### Activity Example {=my:analysis .prov:Activity label}
19
+
20
+ An activity is something that happens over time.
21
+
22
+ Started: [2026-05-06T09:00:00Z] {prov:startedAtTime ^^xsd:dateTime}
23
+ Ended: [2026-05-06T10:30:00Z] {prov:endedAtTime ^^xsd:dateTime}
24
+ Associated with: [Alice] {+my:alice ?prov:wasAssociatedWith}
25
+ Used: [Raw Data] {+my:raw-data ?prov:used}
26
+ Generated: [Report] {+my:report ?prov:generated}
27
+
28
+ ### Agent Example {=my:alice .prov:Person label}
29
+
30
+ An agent is something that can bear responsibility.
31
+
32
+ Name: [Alice Smith] {my:name}
33
+ Email: [alice@example.com] {my:email}
34
+ Role: [Data Analyst] {my:role}
35
+
36
+ ## Qualified Provenance Patterns
37
+
38
+ ### Qualified Usage {=my:qualified-usage .prov:Usage ?prov:qualifiedUsage label}
39
+
40
+ Describes how an entity was used in an activity.
41
+
42
+ Entity: [Raw Data] {+my:raw-data ?prov:entity}
43
+ Activity: [Analysis] {+my:analysis ?prov:activity}
44
+ Role: [Input Dataset] {+my:input-dataset .prov:Role ?prov:hadRole}
45
+ Time: [2026-05-06T09:15:00Z] {prov:atTime ^^xsd:dateTime}
46
+
47
+ ### Qualified Generation {=my:qualified-generation .prov:Generation ?prov:qualifiedGeneration label}
48
+
49
+ Describes how an entity was generated by an activity.
50
+
51
+ Entity: [Report] {+my:report ?prov:entity}
52
+ Activity: [Analysis] {+my:analysis ?prov:activity}
53
+ Role: [Final Output] {+my:output .prov:Role ?prov:hadRole}
54
+ Time: [2026-05-06T10:30:00Z] {prov:atTime ^^xsd:dateTime}
55
+
56
+ ### Qualified Association {=my:qualified-association .prov:Association ?prov:qualifiedAssociation label}
57
+
58
+ Describes agent's role in an activity.
59
+
60
+ Activity: [Analysis] {+my:analysis ?prov:activity}
61
+ Agent: [Alice] {+my:alice ?prov:agent}
62
+ Role: [Lead Analyst] {+my:lead-analyst .prov:Role ?prov:hadRole}
63
+ Plan: [Q2 Analysis Plan] {+my:q2-plan .prov:Plan ?prov:hadPlan}
64
+
65
+ ## Delegation Pattern
66
+
67
+ ### Delegation Example {=my:delegation .prov:Delegation ?prov:qualifiedDelegation label}
68
+
69
+ Alice delegates authority to Bob for a specific task.
70
+
71
+ Delegate: [Alice] {+my:alice ?prov:delegate}
72
+ Responsible: [Bob] {+my:bob .prov:Person ?prov:responsible}
73
+ Activity: [Data Review] {+my:review .prov:Activity ?prov:hadActivity}
74
+ Role: [Reviewer] {+my:reviewer .prov:Role ?prov:hadRole}
75
+
76
+ ## Complete Provenance Chain
77
+
78
+ ### Research Project {=my:research-project .prov:Entity label}
79
+
80
+ **Initial Dataset Collection** {=my:data-collection .prov:Activity label}
81
+ - Started: [2026-04-01] {prov:startedAtTime ^^xsd:date}
82
+ - Agent: [Research Team] {+my:team ?prov:wasAssociatedWith}
83
+ - Generated: [Dataset v1] {+my:dataset-v1 ?prov:generated}
84
+
85
+ **Data Analysis** {=my:data-analysis .prov:Activity label}
86
+ - Used: [Dataset v1] {+my:dataset-v1 ?prov:used}
87
+ - Started: [2026-04-15] {prov:startedAtTime ^^xsd:date}
88
+ - Agent: [Alice] {+my:alice ?prov:wasAssociatedWith}
89
+ - Generated: [Analysis Results] {+my:analysis-results ?prov:generated}
90
+
91
+ **Report Writing** {=my:report-writing .prov:Activity label}
92
+ - Informed by: [Data Analysis] {+my:data-analysis ?prov:wasInformedBy}
93
+ - Started: [2026-05-01] {prov:startedAtTime ^^xsd:date}
94
+ - Agent: [Alice] {+my:alice ?prov:wasAssociatedWith}
95
+ - Generated: [Final Report] {+my:final-report ?prov:generated}
96
+
97
+ **Final Report** {=my:final-report .prov:Entity label}
98
+ - Generated by: [Report Writing] {+my:report-writing ?prov:wasGeneratedBy}
99
+ - Attributed to: [Alice] {+my:alice ?prov:wasAttributedTo}
100
+ - Derived from: [Analysis Results] {+my:analysis-results ?prov:wasDerivedFrom}
101
+
102
+ This demonstrates:
103
+ - Entity-Activity-Entity chains
104
+ - Complete provenance tracking
105
+ - Qualified relationships with roles
106
+ - Delegation patterns
107
+ - Temporal properties
@@ -0,0 +1,69 @@
1
+ [rdf] <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ [rdfs] <http://www.w3.org/2000/01/rdf-schema#>
3
+ [my] <tag:alice@example.com,2026:>
4
+
5
+ # RDF Fundamentals {=my:rdf-demo .rdfs:Resource label}
6
+
7
+ Demonstrates core RDF concepts using RDF and RDFS vocabularies.
8
+
9
+ ## Class Definitions
10
+
11
+ ### Document Class {=my:Document .rdfs:Class label}
12
+
13
+ A document is a resource that can have content.
14
+
15
+ Properties:
16
+ - **Title**: [string] {+xsd:string ?rdfs:range}
17
+ - **Content**: [text] {+rdfs:Literal ?rdfs:range}
18
+ - **Format**: [string] {+xsd:string ?rdfs:range}
19
+
20
+ ### Person Class {=my:Person .rdfs:Class label}
21
+
22
+ A person is an agent who can create documents.
23
+
24
+ Subclass of: [Agent] {+rdfs:Resource ?rdfs:subClassOf}
25
+
26
+ Properties:
27
+ - **Name**: [string] {+xsd:string ?rdfs:range}
28
+ - **Email**: [string] {+xsd:string ?rdfs:range}
29
+ - **Created**: [Document] {+my:Document ?rdfs:range}
30
+
31
+ ### Property Definitions
32
+
33
+ ### Title Property {=my:title .rdf:Property label}
34
+
35
+ Relates a document to its title.
36
+
37
+ Domain: [Document] {+my:Document ?rdfs:domain}
38
+ Range: [string] {+xsd:string ?rdfs:range}
39
+
40
+ ### Author Property {=my:author .rdf:Property label}
41
+
42
+ Relates a document to its author.
43
+
44
+ Domain: [Document] {+my:Document ?rdfs:domain}
45
+ Range: [Person] {+my:Person ?rdfs:range}
46
+
47
+ ## Instance Data
48
+
49
+ ### Sample Document {=my:sample-doc .my:Document label}
50
+
51
+ Title: [RDF Basics] {my:title}
52
+ Content: [This document explains RDF fundamentals.] {my:content}
53
+ Format: [Markdown] {my:format}
54
+
55
+ ### Sample Person {=my:alice .my:Person label}
56
+
57
+ Name: [Alice Smith] {my:name}
58
+ Email: [alice@example.com] {my:email}
59
+
60
+ ### Connecting Them
61
+
62
+ The document was created by [Alice] {+my:alice ?my:author}.
63
+
64
+ This demonstrates:
65
+ - Class definitions with rdfs:Class
66
+ - Property definitions with rdf:Property
67
+ - Domain and range constraints
68
+ - Subclass relationships with rdfs:subClassOf
69
+ - Instance data with proper typing
@@ -1,31 +1,95 @@
1
1
  [food] <tag:alice@example.com,2026:food/>
2
+ [schema] <http://schema.org/>
2
3
 
3
- ## Apple Pie {=food:pie .prov:Entity label}
4
+ # Grandma's Apple Pie {=food:apple-pie .schema:Recipe prov:Entity label}
4
5
 
5
- Grandma Rose's recipe, documented by Alice. Cook time: [45] {food:time ^^xsd:integer} min, serves [8] {food:serves ^^xsd:integer}.
6
+ Traditional family recipe passed down through generations.
6
7
 
7
- **Ingredients**
8
+ Cuisine: [American] {food:cuisine}
9
+ Prep time: [45] {food:prepTime ^^xsd:integer} minutes
10
+ Cook time: [60] {food:cookTime ^^xsd:integer} minutes
11
+ Servings: [8] {food:servings ^^xsd:integer}
12
+ Difficulty: [Medium] {food:difficulty}
8
13
 
9
- Flour (cups): [2.5] {+#flour ?food:ingredient .food:Ingredient food:ammount ^^food:cup} - used in crust
14
+ ## Dry Ingredients
10
15
 
11
- Sugar (cups): `1` {+#sugar ?food:ingredient .food:Ingredient food:ammount ^^food:cup} used in filling
16
+ **Flour** {+food:flour .food:Ingredient ?prov:wasDerivedFrom label}
17
+ **Sugar** {+food:sugar .food:Ingredient ?food:hasIngredient label}
18
+ **Salt** {+food:salt .food:Ingredient ?food:hasIngredient label}
12
19
 
13
- Butter (cups): *1* {+#butter ?food:ingredient .food:Ingredient food:ammoun ^^food:cupt} used in crust
20
+ ### Wet Ingredients
14
21
 
15
- Apples: **6** {+#apples ?food:ingredient .food:Ingredient food:ammount ^^xsd:integer} used in filling
22
+ **Butter** {+food:butter .food:Ingredient ?food:hasIngredient label}
23
+ **Eggs** {+food:eggs .food:Ingredient ?food:hasIngredient label}
24
+ **Vanilla** {+food:vanilla .food:Ingredient ?food:hasIngredient label}
16
25
 
17
- Cinnamon (tsp): __2__ {+food:cinnamon ?food:ingredient .food:Ingredient ^^xsd:tsp} used in filling
26
+ ### Filling Ingredients
18
27
 
19
- **Process**
28
+ **Apples** {+food:apples .food:Ingredient ?food:hasIngredient label}
29
+ **Cinnamon** {+food:cinnamon .food:Ingredient ?food:hasIngredient label}
30
+ **Lemon Juice** {+food:lemon-juice .food:Ingredient ?food:hasIngredient label}
20
31
 
21
- **Crust** {=food:crust .prov:Activity} mixed [flour] {+food:pie#flour ?prov:used} and [butter] {+food:pie#butter}, generated [dough] {+food:dough ?prov:generated}. Used [bowl] {+food:bowl ?prov:used}.
32
+ ## Preparation Steps {=food:preparation .prov:Activity label}
22
33
 
23
- **Filling** {=food:filling .prov:Activity ?prov:wasInformedBy} prepared apples with sugar and cinnamon, generated [apple mix] {+food:mix ?prov:generated}.
34
+ ### Step 1: Crust {=food:step-crust .prov:Activity label}
24
35
 
25
- **Baking** {=food:bake .prov:Activity ?prov:wasInformedBy} baked at 375°F for 45 min. Used [oven] {+food:oven ?prov:used}. Generated [baked pie] {+food:baked ?prov:generated}.
36
+ Mixed dry ingredients: [flour] {+food:flour ?prov:used}, [sugar] {+food:sugar ?prov:used}, [salt] {+food:salt ?prov:used}. Cut in [cold butter] {+food:butter ?prov:used} until mixture resembles [coarse crumbs] {food:texture}. Form into [pie dish] {+food:pie-dish ?prov:used}.
26
37
 
27
- We got the **Pie** {=food:pie}
38
+ ### Step 2: Filling {=food:step-filling .prov:Activity label}
28
39
 
29
- The final pie was derived from [dough] {+food:dough ?prov:wasDerivedFrom} and [apple mix] {+food:mix ?prov:wasDerivedFrom}.
40
+ Toss [apples] {+food:apples ?prov:used} with [cinnamon] {+food:cinnamon ?prov:used} and [lemon juice] {+food:lemon-juice ?prov:used}. Let sit for [10] {food:restTime ^^xsd:integer} minutes.
30
41
 
31
- **Related**: Apple Crumble {+food:crumble !food:variation .food:Recipe}, Peach Pie {+food:peach !food:variation .food:Recipe}
42
+ ### Step 3: Assembly {=food:step-assembly .prov:Activity label}
43
+
44
+ Add filling to crust. Cover with [top crust] {+food:top-crust .food:Ingredient ?prov:used}. Cut [vent holes] {+food:vents .food:Technique ?prov:used}.
45
+
46
+ ### Step 4: Baking {=food:step-baking .prov:Activity label}
47
+
48
+ Bake at [375°F] {food:bakeTemp ^^xsd:integer} for [45-55] {food:bakeTime ^^xsd:integer} minutes until [golden brown] {food:color} and [bubbly] {food:texture}.
49
+
50
+ ## Recipe Relationships
51
+
52
+ ### Variation {=food:variation .prov:Entity label}
53
+
54
+ This recipe is a variation of [Classic Apple Pie] {+food:classic-apple-pie .schema:Recipe ?food:variationOf}.
55
+
56
+ Also related: [Peach Pie] {+food:peach-pie .schema:Recipe ?food:similarRecipe} and [Apple Crumble] {+food:apple-crumble .schema:Recipe ?food:similarRecipe}.
57
+
58
+ ## Nutrition Information {=food:nutrition .prov:Entity label}
59
+
60
+ Per serving:
61
+ - Calories: [320] {food:calories ^^xsd:integer}
62
+ - Fat: [14g] {food:fat ^^xsd:string}
63
+ - Carbohydrates: [42g] {food:carbs ^^xsd:string}
64
+ - Protein: [2g] {food:protein ^^xsd:string}
65
+
66
+ ## Provenance
67
+
68
+ ### Recipe Creation {=food:creation .prov:Activity label}
69
+
70
+ Created by: [Grandma Rose] {+food:grandma-rose .prov:Person ?prov:wasAssociatedWith}
71
+ Documented by: [Alice] {+food:alice .prov:Person ?prov:wasAssociatedWith}
72
+ Date: [2026-05-06] {prov:startedAtTime ^^xsd:date}
73
+ Used: [Family Recipe Book] {+food:recipe-book ?prov:used}
74
+
75
+ Generated: [Recipe Documentation] {+food:recipe-docs ?prov:generated}.
76
+
77
+ This demonstrates:
78
+ - Schema.org Recipe vocabulary
79
+ - Complex ingredient relationships
80
+ - Multi-step process with provenance
81
+ - Nutritional information
82
+ - Recipe variations and relationships
83
+
84
+
85
+
86
+ - [2.5] {food:amount ^^xsd:decimal} cups
87
+ - [1] {food:amount ^^xsd:decimal} cup
88
+ - [0.5] {food:amount ^^xsd:decimal} tsp
89
+ - [1] {food:amount ^^xsd:decimal} cup, cold
90
+ - [2] {food:amount ^^xsd:integer} large
91
+ - [1] {food:amount ^^xsd:decimal} tsp
92
+
93
+ - [6] {food:amount ^^xsd:integer} medium, peeled, sliced
94
+ - [2] {food:amount ^^xsd:integer} tsp ground
95
+ - [1] {food:amount ^^xsd:integer} tbsp
@@ -1,46 +1,126 @@
1
1
  [research] <https://research.example.org/>
2
2
  [data] <https://research.example.org/datasets/>
3
+ [prov] <http://www.w3.org/ns/prov#>
4
+ [sh] <http://www.w3.org/ns/shacl#>
5
+ [xsd] <http://www.w3.org/2001/XMLSchema#>
3
6
 
4
- # Machine Learning in Healthcare {=research:paper .prov:Entity label}
7
+ # Medical Imaging AI Research {=research:paper .prov:Entity label}
5
8
 
6
- **Authors**: Dr. Sarah Martinez and Dr. James Liu, MIT CS Lab.
9
+ Deep learning analysis of attention mechanisms for medical diagnosis.
7
10
 
8
- **Abstract**
11
+ ## Authors {=research:authors .prov:Entity label}
9
12
 
10
- This paper analyzes attention-based neural networks for medical imaging, citing prior work on deep learning in radiology.
13
+ Research team with defined roles and contributions.
11
14
 
12
- **Methodology**
15
+ ### Primary Author {=research:sarah-martinez .prov:Person label}
16
+ Name: [Dr. Sarah Martinez] {rdfs:label}
17
+ Email: [sarah.martinez@mit.edu] {research:email}
18
+ Role: [Lead Researcher] {research:role}
19
+ Contribution: [Methodology development] {research:contribution}
13
20
 
14
- **Dataset** {=data:dataset .research:Dataset}
15
- Source: GitHub medical imaging repository
16
- Training: [80k] {+data:train ?research:detail .research:DatasetDetail} DICOM images, 15 classes
17
- Validation: [10k] {+data:val ?research:detail .research:DatasetDetail} DICOM images
18
- Test: [10k] {+data:test ?research:detail .research:DatasetDetail} DICOM images
21
+ ### Co-Author {=research:james-liu .prov:Person label}
22
+ Name: [Dr. James Liu] {rdfs:label}
23
+ Email: [james.liu@mit.edu] {research:email}
24
+ Role: [ML Engineer] {research:role}
25
+ Contribution: [Model implementation] {research:contribution}
19
26
 
20
- **Kaggle Dataset** {=data:kaggle .research:Dataset} derived from primary dataset, featuring 512x512 grayscale images with patient metadata.
27
+ ## Research Activity {=research:research-activity .prov:Activity label}
21
28
 
22
- **Model Training** {=research:training .prov:Activity}
23
- Duration: Feb 1-15, 2024
24
- Association: Dr. James Liu as ML Engineer
25
- Plan: Training protocol v2.0
26
- Used: ML Dataset and Kaggle Dataset
27
- Generated: [trained model] {+research:model ?prov:generated}
29
+ Complete research lifecycle with proper provenance.
28
30
 
29
- **Results**
31
+ Started: [2024-01-01] {prov:startedAtTime ^^xsd:date}
32
+ Ended: [2024-03-15] {prov:endedAtTime ^^xsd:date}
33
+ Associated with: [Research Team] {+research:authors ?prov:wasAssociatedWith}
34
+ Plan: [Medical AI Research Plan] {+research:plan .prov:Plan ?prov:hadPlan}
30
35
 
31
- Statistical significance: p < 0.05, sample size: [1000] {research:n ^^xsd:integer} patients.
36
+ ## Dataset Collection {=research:dataset-collection .prov:Activity label}
32
37
 
33
- **Accuracy Metrics** {=research:metrics .prov:Entity}
34
- Training: [94.5%] {research:trainAcc}
35
- Validation: [92.3%] {research:valAcc}
36
- Test: [91.8%] {research:testAcc}
37
- F1: [0.89] {research:f1 ^^xsd:decimal}
38
+ Systematic dataset gathering and validation.
39
+
40
+ ### Primary Dataset {=data:primary-dataset .research:Dataset label}
41
+ Source: [GitHub Medical Imaging Repository] {research:source}
42
+ Training samples: [80000] {data:trainCount ^^xsd:integer} DICOM images
43
+ Validation samples: [10000] {data:valCount ^^xsd:integer} DICOM images
44
+ Test samples: [10000] {data:testCount ^^xsd:integer} DICOM images
45
+ Classes: [15] {data:classCount ^^xsd:integer} anatomical structures
46
+
47
+ ### Augmented Dataset {=data:augmented-dataset .research:Dataset label}
48
+ Derived from: [Primary Dataset] {+data:primary-dataset ?prov:wasDerivedFrom}
49
+ Resolution: [512x512] {data:resolution} grayscale
50
+ Features: [Patient metadata] {data:features}
51
+ Sample size: [1000] {data:patientCount ^^xsd:integer} patients
52
+
53
+ ## Model Development {=research:model-development .prov:Activity label}
54
+
55
+ Training process with resource tracking.
56
+
57
+ Started: [2024-02-01] {prov:startedAtTime ^^xsd:date}
58
+ Ended: [2024-02-28] {prov:endedAtTime ^^xsd:date}
59
+ Used: [Primary Dataset] {+data:primary-dataset ?prov:used} and [Augmented Dataset] {+data:augmented-dataset ?prov:used}
60
+ Associated with: [Dr. James Liu] {+research:james-liu ?prov:wasAssociatedWith} as ML Engineer
61
+ Generated: [Trained Model] {+research:trained-model ?prov:generated}
62
+
63
+ ## Model Evaluation {=research:evaluation .prov:Activity label}
64
+
65
+ Comprehensive testing with statistical validation.
66
+
67
+ Started: [2024-03-01] {prov:startedAtTime ^^xsd:date}
68
+ Used: [Trained Model] {+research:trained-model ?prov:used}
69
+ Generated: [Evaluation Results] {+research:eval-results ?prov:generated}
70
+
71
+ ### Performance Metrics {=research:metrics .prov:Entity label}
72
+ Training accuracy: [94.5] {research:trainAcc ^^xsd:decimal}
73
+ Validation accuracy: [92.3] {research:valAcc ^^xsd:decimal}
74
+ Test accuracy: [91.8] {research:testAcc ^^xsd:decimal}
75
+ F1 score: [0.89] {research:f1 ^^xsd:decimal}
38
76
  AUC-ROC: [0.93] {research:auc ^^xsd:decimal}
77
+ Statistical significance: [p < 0.05] {research:significance}
78
+ Sample size: [1000] {research:sampleSize ^^xsd:integer}
79
+
80
+ ## SHACL Validation Shapes
81
+
82
+ ### Paper Validation Shape {=research:PaperShape .sh:NodeShape label}
83
+
84
+ Ensures scientific papers meet academic standards. Targets all instances of [Paper] {+research:Paper ?sh:targetClass} to have a [title] {+#title ?sh:property sh:name}, [authors] {+#author ?sh:property sh:name} and [citations] {+#citation ?sh:property sh:name}.
85
+
86
+ ### Paper must have exactly one title. {=#title .sh:PropertyShape sh:message}
87
+ Path: [title] {+rdfs:label ?sh:path}
88
+ Required: [1] {sh:minCount sh:maxCount ^^xsd:integer}
89
+
90
+ ## Paper must have at least one author. {=#author .sh:PropertyShape sh:message}
91
+ Path: [author] {+research:author ?sh:path}
92
+ Required: [1] {sh:minCount ^^xsd:integer}
93
+
94
+ ## Paper must have at least one citation. {=#citation .sh:PropertyShape sh:message}
95
+ Path: [citation] {+research:citation ?sh:path}
96
+ Required: [1] {sh:minCount ^^xsd:integer}
97
+
98
+ ### Test Data
99
+
100
+ #### Valid Paper {=research:valid-paper .research:Paper label}
101
+ Title: [Medical Imaging AI Research] {rdfs:label}
102
+ Authors: [Dr. Sarah Martinez] {+research:sarah-martinez ?research:author}
103
+ Citations: [15] {research:citation ^^xsd:integer}
104
+
105
+ #### Invalid Paper {=research:invalid-paper .research:Paper label}
106
+ Title: [Untitled] {rdfs:label}
107
+ Authors: [] {research:citation}
108
+
109
+ ## Funding and Provenance
110
+
111
+ ### Funding Entity {=research:funding .prov:Entity label}
112
+ Grant: [NRA-2024-12345] {research:grantNumber}
113
+ Amount: [$500,000] {research:amount ^^xsd:decimal}
114
+ Source: [NASA Space Medicine] {+research:nasa ?prov:wasAttributedTo .prov:Organization}
115
+ Period: [2024-2026] {research:period}
39
116
 
40
- **SHACL Validation** {=research:shape .sh:NodeShape}
41
- Target: Scientific Paper
42
- Title: exactly 1 required
43
- Author: at least 1 required
44
- Citations: at least 1 required
117
+ ### Publication Activity {=research:publication .prov:Activity label}
118
+ Published: [Medical Imaging AI Research] {+research:paper ?prov:used} in [Medical Journal] {+research:journal ?prov:wasGeneratedBy}
119
+ Date: [2024-04-15] {prov:startedAtTime ^^xsd:date}
45
120
 
46
- **Funding**: NASA Space Medicine Research Initiative, grant NRA-2024-12345.
121
+ This demonstrates:
122
+ - Complete PROV-O provenance chains
123
+ - Dataset management with XSD typing
124
+ - SHACL validation with self-documenting
125
+ - Academic research lifecycle
126
+ - Proper ontology integration
@@ -0,0 +1,161 @@
1
+ [sh] <http://www.w3.org/ns/shacl#>
2
+ [rdf] <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
3
+ [rdfs] <http://www.w3.org/2000/01/rdf-schema#>
4
+ [xsd] <http://www.w3.org/2001/XMLSchema#>
5
+ [my] <tag:alice@example.com,2026:>
6
+
7
+ # SHACL Validation Demo {=my:shacl-demo .prov:Entity label}
8
+
9
+ Demonstrates SHACL validation shapes with self-documenting examples.
10
+
11
+ ## Person Validation Shape
12
+
13
+ ### Person Shape {=my:PersonShape .sh:NodeShape label}
14
+
15
+ Validates all [Person] {+my:Person ?sh:targetClass} nodes with proper constraints.
16
+
17
+ **Name Rule** {+my:PersonShape-name .sh:PropertyShape ?sh:property}
18
+ Path: [name] {+rdfs:label ?sh:path}
19
+ Required: [1] {sh:minCount ^^xsd:integer sh:maxCount ^^xsd:integer}
20
+ Datatype: [string] {+xsd:string ?sh:datatype}
21
+
22
+ > Every person must have exactly one name. {sh:message}
23
+
24
+ **Email Rule** {+my:PersonShape-email .sh:PropertyShape ?sh:property}
25
+ Path: [email] {+my:email ?sh:path}
26
+ Required: [1] {sh:minCount ^^xsd:integer}
27
+ Datatype: [string] {+xsd:string ?sh:datatype}
28
+ Pattern: [.*@.*] {sh:pattern}
29
+
30
+ > Email must be a valid email address. {sh:message}
31
+
32
+ **Age Rule** {+my:PersonShape-age .sh:PropertyShape ?sh:property}
33
+ Path: [age] {+my:age ?sh:path}
34
+ Datatype: [integer] {+xsd:integer ?sh:datatype}
35
+ Minimum: [0] {sh:minInclusive ^^xsd:integer}
36
+ Maximum: [150] {sh:maxInclusive ^^xsd:integer}
37
+
38
+ > Age must be between 0 and 150 years. {sh:message}
39
+
40
+ ## Test Data
41
+
42
+ ### Valid Person {=my:valid-person .my:Person label}
43
+
44
+ Name: [Alice Smith] {rdfs:label}
45
+ Email: [alice@example.com] {my:email}
46
+ Age: [30] {my:age ^^xsd:integer}
47
+
48
+ ### Invalid Person {=my:invalid-person .my:Person label}
49
+
50
+ Name: [Bob] {rdfs:label}
51
+ Age: [-5] {my:age ^^xsd:integer}
52
+
53
+ ## Product Validation Shape
54
+
55
+ ### Product Shape {=my:ProductShape .sh:NodeShape label}
56
+
57
+ Validates [Product] {+my:Product ?sh:targetClass} nodes with business rules.
58
+
59
+ **SKU Rule** {+my:ProductShape-sku .sh:PropertyShape ?sh:property}
60
+ Path: [sku] {+my:sku ?sh:path}
61
+ Required: [1] {sh:minCount ^^xsd:integer sh:maxCount ^^xsd:integer}
62
+ Datatype: [string] {+xsd:string ?sh:datatype}
63
+ Min length: [3] {sh:minLength ^^xsd:integer}
64
+ Max length: [50] {sh:maxLength ^^xsd:integer}
65
+
66
+ > Product SKU must be 3-50 characters. {sh:message}
67
+
68
+ **Price Rule** {+my:ProductShape-price .sh:PropertyShape ?sh:property}
69
+ Path: [price] {+my:price ?sh:path}
70
+ Required: [1] {sh:minCount ^^xsd:integer}
71
+ Datatype: [decimal] {+xsd:decimal ?sh:datatype}
72
+ Minimum: [0.01] {sh:minInclusive ^^xsd:decimal}
73
+
74
+ > Product price must be positive. {sh:message}
75
+
76
+ **Category Rule** {+my:ProductShape-category .sh:PropertyShape ?sh:property}
77
+ Path: [category] {+my:category ?sh:path}
78
+ Required: [1] {sh:minCount ^^xsd:integer}
79
+ In: [Electronics, Books, Clothing] {+my:categories ?sh:in}
80
+
81
+ > Category must be one of: Electronics, Books, Clothing. {sh:message}
82
+
83
+ ## Test Data
84
+
85
+ ### Valid Product {=my:valid-product .my:Product label}
86
+
87
+ SKU: [ELEC-001] {my:sku}
88
+ Name: [Wireless Mouse] {rdfs:label}
89
+ Price: [29.99] {my:price ^^xsd:decimal}
90
+ Category: [Electronics] {my:category}
91
+
92
+ ### Invalid Product {=my:invalid-product .my:Product label}
93
+
94
+ SKU: [AB] {my:sku}
95
+ Price: [-10.00] {my:price ^^xsd:decimal}
96
+ Category: [Toys] {my:category}
97
+
98
+ ## Complex Validation Shape
99
+
100
+ ### Order Validation Shape {=my:OrderShape .sh:NodeShape label}
101
+
102
+ Validates [Order] {+my:Order ?sh:targetClass} with conditional logic.
103
+
104
+ **Customer Rule** {=my:OrderShape-customer .sh:PropertyShape ?sh:property}
105
+ Path: [customer] {+my:customer ?sh:path}
106
+ Required: [1] {sh:minCount ^^xsd:integer}
107
+ Node: [Person] {+my:Person ?sh:node}
108
+
109
+ > Order must have a valid customer. {sh:message}
110
+
111
+ **Items Rule** {=my:OrderShape-items .sh:PropertyShape ?sh:property}
112
+ Path: [items] {+my:items ?sh:path}
113
+ Min count: [1] {sh:minCount ^^xsd:integer}
114
+ Node kind: [BlankNodeOrIRI] {+sh:BlankNodeOrIRI ?sh:nodeKind}
115
+
116
+ > Order must have at least one item. {sh:message}
117
+
118
+ **Total Validation** {=my:OrderShape-total .sh:PropertyShape ?sh:property}
119
+ Path: [total] {+my:total ?sh:path}
120
+ Datatype: [decimal] {+xsd:decimal ?sh:datatype}
121
+ Min inclusive: [0.01] {sh:minInclusive ^^xsd:decimal}
122
+
123
+ > Order total must be positive. {sh:message}
124
+
125
+ ## Logical Constraints
126
+
127
+ ### Exclusive Properties Shape {=my:ExclusiveShape .sh:NodeShape label}
128
+
129
+ Shows OR (sh:or) and XOR (sh:xone) constraints.
130
+
131
+ **Either/Or Rule** {=my:ExclusiveShape-either .sh:PropertyShape ?sh:property}
132
+ Path: [identifier] {+my:identifier ?sh:path}
133
+ Or: [email, phone] {+my:email ?sh:or +my:phone ?sh:property}
134
+
135
+ > Must have either email OR phone. {sh:message}
136
+
137
+ **Exactly One/XOne Rule** {=my:ExclusiveShape-exactly .sh:PropertyShape ?sh:property}
138
+ Path: [primaryContact] {+my:primaryContact ?sh:path}
139
+ Xone: [email, phone] {+my:email ?sh:xone +my:phone ?sh:property}
140
+
141
+ > Must have exactly one primary contact method. {sh:message}
142
+
143
+ ## Test Data
144
+
145
+ ### Valid Contact {=my:valid-contact .my:Person label}
146
+
147
+ Email: [contact@example.com] {my:email}
148
+ Phone: [555-1234] {my:phone}
149
+ Primary contact: [email] {my:primaryContact}
150
+
151
+ ### Invalid Contact {=my:invalid-contact .my:Person label}
152
+
153
+ Phone: [555-5678] {my:phone}
154
+ Primary contact: [email] {my:primaryContact}
155
+
156
+ This demonstrates:
157
+ - NodeShape targeting with sh:targetClass
158
+ - PropertyShape constraints (datatype, min/max, patterns)
159
+ - Logical constraints (sh:or, sh:xone, sh:in)
160
+ - Self-validating examples with clear violations
161
+ - Complex validation scenarios