Hi Gary,
to support solution b), see the attached example. The SWA auto-complete
widget currently requires sh:not to be used to point at shapes that the
given matches do not conform to. You can exclude any non-schema.org
resource by wrapping a dash:stem into another sh:not, as outlined. (I
only tested with the upcoming 5.4 release, hoping the version that you
have behaves similarly).
HTH
Holger
On 21/09/2017 23:00, Gary Murphy wrote:
I think it would be B -- in an edit form I use swa:Objects to allow
changing or adding additional rdf:type classes, but would like to
restrict the auto-complete listings to only include classes within the
schema.org <http://schema.org> namespace, so I'm restricting a
property where the values are classes.
On Wed, Sep 20, 2017 at 10:00 PM, Holger Knublauch
<[email protected] <mailto:[email protected]>> wrote:
To help my understanding of your use case: Do you want to
a) restrict a property to values that have an rdf:type from the
schema.org <http://schema.org> namespace? (That could probably be
achieved via sh:class schema:Thing)
b) restrict a property to classes from the schema.org
<http://schema.org> namespace (i.e. the values itself are classes)
Holger
On 21/09/2017 3:00, Gary Murphy wrote:
This is my first dip into SHACL constraints, and what I'm needing
might be easy to do, only I'm stuck at the last step...
My objective is to constrain swa:URIResourceEditor to only offer
auto-complete on an rdf:type with classes in the schema.org
<http://schema.org> namespace, which is exactly what the comment
on the URIResourceEditor says it can do:
The auto-complete can apply a model-driven filter to the
resources. If the subject has SHACL property constraints for
the given predicate, then it will filter out all nodes where
one of the shapes specified via sh:not is not fulfilled.
Among others, this makes it possible to filter out system
namespaces (via tosh:SystemNamespaceShape)
Since I want this to apply to all schema.org <http://schema.org>
subjects, I set out to add the sh:property constraint to
schema:Thing only rather than the tosh:SystemNamespaceShape it
seemed more appropriate to use the dash:StemConstraintComponent
and this is where it stopped: in the list of constraint shapes I
find dash:StemConstraintComponent-stem (which would be the value
of the IRI stem?) but no where to set the value of that stem.
Am I going in the right direction with this? Do I need to define
my own value shape somewhere that would define itself in terms of
calling dash:StemConstraintComponent with the -stem parameter?
Or should I define a new value shape, much like
tosh:SystemNamespaceShape and using sparql to just test that the
object starts-with the right namespace?
--
You received this message because you are subscribed to the
Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "TopBraid
Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# baseURI: http://example.org/schemaAutoComplete
# imports: http://datashapes.org/dash
# prefix: schemaAutoComplete
@prefix dash: <http://datashapes.org/dash#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schemaAutoComplete: <http://example.org/schemaAutoComplete#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.org/schemaAutoComplete>
rdf:type owl:Ontology ;
owl:imports <http://datashapes.org/dash> ;
owl:versionInfo "Created with TopBraid Composer" ;
.
schemaAutoComplete:SchemaStemShape
rdf:type sh:NodeShape ;
dash:stem "http://schema.org/" ;
rdfs:label "Schema stem shape" ;
.
schemaAutoComplete:TestClass
rdf:type owl:Class ;
rdf:type sh:NodeShape ;
rdfs:label "Test class" ;
rdfs:subClassOf owl:Thing ;
sh:property [
sh:path schemaAutoComplete:testProperty ;
sh:class rdfs:Class ;
sh:maxCount 1 ;
sh:not [
sh:not schemaAutoComplete:SchemaStemShape ;
] ;
] ;
.
schemaAutoComplete:testProperty
rdf:type rdf:Property ;
rdfs:label "test property" ;
.