Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions whyis/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class NamespaceContainer(object):
sdd = rdflib.Namespace("http://purl.org/twc/sdd/")
csvw = rdflib.Namespace("http://www.w3.org/ns/csvw#")
text = rdflib.Namespace("http://jena.apache.org/fulltext#")
sh = rdflib.Namespace("http://www.w3.org/ns/shacl#")

@property
def prefixes(self):
Expand Down
15 changes: 15 additions & 0 deletions whyis/templates/incoming_class.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
{{'''graph ?assertion {
{
# Original class hierarchy relationships
?source rdfs:subClassOf|owl:equivalentClass ?target.
?source ?link_type ?target.
}
UNION {
# SHACL property shapes: PropertyShape with sh:class/sh:node pointing to target
?nodeshape sh:property ?source.
?source sh:class|sh:node ?target.
?source ?link_type ?target.
}
UNION {
# Classes used directly as NodeShapes with property shapes
?source rdf:type sh:NodeShape.
?source sh:property ?propshape.
?propshape sh:class|sh:node ?target.
?propshape ?link_type ?target.
bind(?source as ?source)
}
}
bind(1 as ?probability)
bind(?assertion as ?link)
Expand Down
26 changes: 26 additions & 0 deletions whyis/templates/outgoing_class.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
{{'''graph ?assertion {
{
# Original class hierarchy relationships
?source rdfs:subClassOf ?target.
?source ?link_type ?target.
}
UNION {
# SHACL NodeShape: current class targets other classes
?source sh:targetClass ?target.
?source ?link_type ?target.
}
UNION {
# SHACL PropertyShape: current class has property shapes pointing to other classes
?source sh:property ?propshape.
?propshape sh:class|sh:node ?target.
?propshape ?link_type ?target.
}
UNION {
# Current class used as NodeShape with property shapes pointing to other classes
?source rdf:type sh:NodeShape.
?source sh:property ?propshape.
?propshape sh:class|sh:node ?target.
?propshape ?link_type ?target.
}
UNION {
# Property shapes where current class is referenced via sh:class/sh:node
?nodeshape sh:property ?propshape.
?propshape sh:class|sh:node ?source.
?nodeshape sh:targetClass ?target.
?nodeshape ?link_type ?target.
}
}
bind(1 as ?probability)
bind(?assertion as ?link)
Expand Down