Skip to content

Commit

Permalink
extract allowed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomociti committed Oct 12, 2024
1 parent f74dd8a commit 5452c13
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 11 additions & 5 deletions dist/compile.n3
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,20 @@ sh:in this:constraint sh:InConstraintComponent .
{ ?value this:nodeKind sh:IRI } <= { ?value log:rawType log:Other . ?value log:uri [] }.

# ClosedConstraintComponent
{
?shape this:allowedProperties ?allowed
}
<=
{
?shape a this:Shape ; sh:closed true .
(?x { ?shape sh:property [ sh:path ?x ] . ?x this:nodeKind sh:IRI } ?existing) log:collectAllIn [] .
(?x { ?shape sh:ignoredProperties [ list:member ?x ]} ?ignored) log:collectAllIn [] .
(?existing ?ignored) list:append ?allowed .

} .

{
?shape this:allowedProperties ?allowed .
?allowed log:localN3String ?allowedString .
("allowed properties are only: %s" ?allowedString) string:format ?message .
}
Expand All @@ -228,10 +237,7 @@ sh:in this:constraint sh:InConstraintComponent .
} .

{
?shape a this:Shape ; sh:closed true .
(?x { ?shape sh:property [ sh:path ?x ] . ?x this:nodeKind sh:IRI } ?existing) log:collectAllIn [] .
(?x { ?shape sh:ignoredProperties [ list:member ?x ]} ?ignored) log:collectAllIn [] .
(?existing ?ignored) list:append ?allowed .
?shape this:allowedProperties ?allowed .
}
=>
{
Expand All @@ -240,7 +246,7 @@ sh:in this:constraint sh:InConstraintComponent .
}
<=
{
?node ?property ?value .
?node ?property [] .
?allowed list:notMember ?property .
} .
} .
Expand Down
16 changes: 11 additions & 5 deletions rules/compile/core-components-others.n3
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@
{ ?value this:nodeKind sh:IRI } <= { ?value log:rawType log:Other . ?value log:uri [] }.

# ClosedConstraintComponent
{
?shape this:allowedProperties ?allowed
}
<=
{
?shape a this:Shape ; sh:closed true .
(?x { ?shape sh:property [ sh:path ?x ] . ?x this:nodeKind sh:IRI } ?existing) log:collectAllIn [] .
(?x { ?shape sh:ignoredProperties [ list:member ?x ]} ?ignored) log:collectAllIn [] .
(?existing ?ignored) list:append ?allowed .

} .

{
?shape this:allowedProperties ?allowed .
?allowed log:localN3String ?allowedString .
("allowed properties are only: %s" ?allowedString) string:format ?message .
}
Expand All @@ -41,10 +50,7 @@
} .

{
?shape a this:Shape ; sh:closed true .
(?x { ?shape sh:property [ sh:path ?x ] . ?x this:nodeKind sh:IRI } ?existing) log:collectAllIn [] .
(?x { ?shape sh:ignoredProperties [ list:member ?x ]} ?ignored) log:collectAllIn [] .
(?existing ?ignored) list:append ?allowed .
?shape this:allowedProperties ?allowed .
}
=>
{
Expand All @@ -53,7 +59,7 @@
}
<=
{
?node ?property ?value .
?node ?property [] .
?allowed list:notMember ?property .
} .
} .
Expand Down

0 comments on commit 5452c13

Please sign in to comment.