Skip to content

Commit

Permalink
Add rule to deal with subproperties and equivalent properties (#624)
Browse files Browse the repository at this point in the history
* add subproperty and fix equivalent class rule

* bump brickschema
  • Loading branch information
gtfierro authored Mar 4, 2024
1 parent 39d3207 commit 49505f5
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
36 changes: 36 additions & 0 deletions bricksrc/rules.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,42 @@ skos:narrower rdf:type rdf:Property ;
owl:inverseOf skos:broader ;
.

bsh:EquivalentPropertyRule
a sh:NodeShape ;
sh:rule [
a sh:SPARQLRule ;
sh:construct """
CONSTRUCT {
?s ?t2 ?o .
} WHERE {
?s $this ?o .
{ $this owl:equivalentProperty ?t2 }
UNION
{ ?t2 owl:equivalentProperty $this }
}""" ;
sh:prefixes <https://brickschema.org/schema/1.3/Brick> ;
] ;
sh:targetSubjectsOf owl:equivalentProperty ;
.


bsh:SubPropertyOfRule
a sh:NodeShape ;
sh:rule [
a sh:SPARQLRule ;
sh:construct """
CONSTRUCT {
?s ?t2 ?o .
} WHERE {
?s $this ?o .
{ $this rdfs:subPropertyOf ?t2 }
}""" ;
sh:prefixes <https://brickschema.org/schema/1.3/Brick> ;
] ;
sh:targetSubjectsOf rdfs:subPropertyOf ;
.


bsh:InferInverseProperties
a sh:NodeShape ;
sh:rule [
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pytest>=7.3
tqdm>=4.0
pyshacl>=0.25
docker>=6.0
brickschema[all]>=0.7.4a9
brickschema[all]>=0.7.5
black==23.3.0
pre-commit>=3.2
flake8>=6.0
Expand Down
8 changes: 4 additions & 4 deletions support/brickpatches.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -1131,17 +1131,17 @@ brick:hasLocation
brick:isLocationOf
owl:equivalentProperty rec:isLocationOf ;
.
brick:hasPart
owl:equivalentProperty rec:hasPart ;
rec:hasPart
rdfs:subPropertyOf brick:hasPart ;
.
brick:hasPoint
owl:equivalentProperty rec:hasPoint ;
.
brick:isFedBy
owl:equivalentProperty rec:isFedBy ;
.
brick:isPartOf
owl:equivalentProperty rec:isPartOf ;
rec:isPartOf
rdfs:subPropertyOf brick:isPartOf ;
.
brick:isPointOf
owl:equivalentProperty rec:isPointOf ;
Expand Down
5 changes: 2 additions & 3 deletions tests/test_entity_properties.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from rdflib import Namespace, Literal
from brickschema.namespaces import BRICK, A, REF, XSD
import os
from rdflib import Namespace, Literal, XSD
from brickschema.namespaces import BRICK, A, REF

EX = Namespace("urn:ex#")

Expand Down

0 comments on commit 49505f5

Please sign in to comment.