-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from psychoinformatics-de/shaclpatch
Add shaclgen patch for correct handling of `sh:order`
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Prevent creation of faulty order lists, where order should just be | ||
a single numerical value. See for context: | ||
https://github.com/linkml/linkml/pull/2111#issuecomment-2116208229 | ||
--- shaclgen.py | ||
+++ shaclgen.py | ||
@@ -112,8 +112,6 @@ class ShaclGenerator(Generator): | ||
g.add((pnode, p, Literal(v))) | ||
|
||
prop_pv(SH.path, slot_uri) | ||
- prop_pv_literal(SH.order, order) | ||
- order += 1 | ||
prop_pv_literal(SH.name, s.title) | ||
prop_pv_literal(SH.description, s.description) | ||
# minCount | ||
@@ -220,6 +218,11 @@ class ShaclGenerator(Generator): | ||
default_value = ifabsent_processor.process_slot(s, c) | ||
if default_value: | ||
prop_pv(SH.defaultValue, default_value) | ||
+ | ||
+ # sh:order may already have been added to the graph via annotations | ||
+ if not (pnode, SH.order, None) in g: | ||
+ prop_pv_literal(SH.order, order) | ||
+ order += 1 | ||
|
||
return g | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters