Open VladimirAlexiev opened 2 years ago
I have no strong opinion here, neither do I "own" this language.
There is the usual trade-off between keeping the language simple and adding greater expressiveness. SHACLC is not meant to cover all possible SHACL design patterns.
Do you have a proposal for how the SHACLC should look like to cover your use case? Does ShEx have something similar that we could borrow?
Is there any technical reason SHACLC++ can't cover all SHACL expressions?
xone
isn't primitive: A xone B = (A and (not B)) or ((not A) and B)
.
Can that be used to write it in SHACL? (yes, with the duplication, and using refs to node shapes).
ShEx has "OneOf", which is |
within tripleExpression
s, because triples are matched and assigned to partitions, not "used twice". It also has "OR"/"AND"/"NOT".
I see no technical obstacles, only that any such coverage of all SHACL features may converge towards a Turtle-like syntax. Yes we could come up with more special syntax such as an xone operator but at some stage I wonder why people would prefer to learn all these details if they already have a generic and consistent solution with Turtle, which can also express non-SHACL triples.
only that any such coverage of all SHACL features may converge towards a Turtle-like syntax.
In a SHACLC parser that I was working on a while back, I had was adding the option to 'escape' (using a backslash IIRC) into Turtle to add anything that was not covered by the existing SHACLC spec - so that is another way to get full SHACL spec coverage with minimal implementation overhead as one can just make use of existing Turtle syntax parsers.
For reference this is the implementation - planning on coming back to finish it up in a month or two WIP SHACLC Parser: https://github.com/jeswr/shaclcjs WIP SHACLC Writer: https://github.com/jeswr/shaclc-writer
@jeswr Yes I did something similar a while back for GraphQL support. Basically, GraphQL has its own schema language that is less expressive than SHACL. So in my converter from SHACL to GraphQL schema, I ticked off all triples that it was able to convert to GraphQL built-ins and then added an escape mechanism to append a Turtle snippet for "all other" triples.
@HolgerKnublauch Can a syntax like this work?
shape nomShape:concept {
( skos:topConceptOf hasValue=nom: [1..1]
|
skos:broader @nomShape:parentConcept [1..1]
) message="Concepts must either have skos:topConcept pointing to the nom: scheme, or have a parent that's in the same scheme".
}
at some stage I wonder why people would prefer to learn all these details if they already have a generic and consistent solution with Turtle
Because when doing modeling, people want to concentrate on the model, not the syntax. So a syntax that's 10x briefer is much preferable to a heavier syntax. Just like:
@afs SHEX References:
|
): https://book.validatingrdf.com/bookHtml010.html#sec87You're right that "xone isn't primitive" but
|
to the former and OR
to the latterWhat's missing: the generality of logic operators on shapes. SHACL-C has a fixed OR-AND structure which covers the most common case.
{...}
" for nesting control{...}
within the fixed layout form @VladimirAlexiev --
I want to implement a constraint "Each SKOS Concept must either have skos:topConcept pointing to the
nom:
scheme, or have a parent that's in the same scheme". I have 2 problems:xone
so I have to use OR (|
)nodeValue
(nodeParam=iriOrLiteralOrArray
)propertyAtom
and thennodeShapeBody
but by that time you've already made onepath
...The best I can come up with is this:
The first
|
is an alternative prop path, and the second|
ispropertyOr
. So this says "Each concept must have topConceptOf or broader, and the value must be either the nom: scheme, or satisfy nomShape:parentConcept", and is correctly translated to this SHACL:But it doesn't preclude the mixed-up variants
skos:broader nom:
orskos:topConceptOf <parentConcept>
.What I want is shaclc grammar that can produce this shacl:
@HolgerKnublauch Can you help?