Can I specify a pattern on an IRI? #3054
Unanswered
Ostrzyciel
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
nmdc-schema puts pattern constraints on some slots that have the uriorcurie
type but we don't use shacl or shex. But it does seem to confuse some cli
tools. I consider it risky.
- Mark
…On Sat, Jan 3, 2026 at 5:30 AM Piotr Sowiński ***@***.***> wrote:
I'm using LinkML to generate SHACL schemas. I want achieve the equivalent
of sh:pattern applied to sh:nodeKind sh:IRI:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX schema: <http://schema.org/>PREFIX sh: <http://www.w3.org/ns/shacl#>PREFIX : <https://example.org/shapes#>
:PersonShape a sh:NodeShape ;
sh:targetClass schema:Person ;
sh:property [
sh:path foaf:knows ;
sh:pattern "^https://example.org/people/.+$" ;
sh:nodeKind sh:IRI
] .
I tried the following in LinkML:
name: Peopleid: https://example.org/shapes#Peopleimports:
- linkml:typesprefixes:
ex: https://example.org/shapes#
linkml: https://w3id.org/linkml/
foaf: http://xmlns.com/foaf/0.1/
schema: http://schema.org/default_prefix: ex
slots:
knows:
slot_uri: foaf:knows
multivalued: true
range: objectidentifier
pattern: '^https://example.org/people/.+$'
classes:
Person:
class_uri: schema:Person
slots:
- knows
But that results in a shape like this:
schema1:Person a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type ) ;
sh:property [ sh:datatype <http://www.w3.org/ns/shex#iri> ;
sh:nodeKind sh:Literal ;
sh:order 0 ;
sh:path foaf:knows ;
sh:pattern "^https://example.org/people/.+$" ] ;
sh:targetClass schema1:Person .
Which not what I want. This shape does not allow the slot value to be an
IRI.
I also tried uriorcurie instead, but it also results in sh:nodeKind
sh:Literal with datatype xsd:anyURI.
I also looked at using enums for this, but I couldn't figure out the
syntax for specifying them, it's very complex.
Is this possible to achieve in LinkML?
—
Reply to this email directly, view it on GitHub
<#3054>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGAEX6NDMDNGQDVR6BZY6BD4E6K3RAVCNFSM6AAAAACQSWKZ22VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZZGMYDGNZYHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
-Mark
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using LinkML to generate SHACL schemas. I want achieve the equivalent of
sh:patternapplied tosh:nodeKind sh:IRI:I tried the following in LinkML:
But that results in a shape like this:
Which not what I want. This shape does not allow the slot value to be an IRI.
I also tried
uriorcurieinstead, but it also results insh:nodeKind sh:Literalwith datatypexsd:anyURI.I also looked at using enums for this, but I couldn't figure out the syntax for specifying them, it's very complex.
Is this possible to achieve in LinkML?
Beta Was this translation helpful? Give feedback.
All reactions