Thanks, Irene. Using the same ttl file for both data and graph worked with no validation error. Thanks for all your suggestions.
On Thursday, October 10, 2019 at 2:52:31 PM UTC-4, Irene Polikoff wrote: > > You do not need to separate them into 2 graphs for the purposes of > validation. Shape graph and data graph are just roles. You could use a > single graph as both, shapes and data. > > Try running validation again with a single graph in both roles and see if > it works. > > As a best practice, we recommend separating schema (shapes) from data > (instances) and connecting a graph with instances with a graph that defines > schema using Includes/owl:imports mechanism. > > If you have an ontology that contains instances as well as schema, you can > refactor instances into a separate graph using Transform-> Copy or Move > Instances from Other Asset Collection: > > First, create a new asset collection. > Include in it ontology that contains your schema and the instances you > want to move. > Then, go to Transform tab and select a class to move instances from. > > You do not have to include a collection with instances in order to move > resources from it, but you do need to have the schema definitions included. > > > > On Oct 10, 2019, at 2:35 PM, Fan Li <[email protected] <javascript:>> > wrote: > > > > Sorry for the confusion. I have the classes and instances in a single > graph in EDG (attached). I separated them into two files in order to submit > through the SHACL validation form > (/edg/tbl/swp?_viewClass=tblshacl%3AValidationPage). This may have been the > reason for the error, but I am not sure. > > > > > > On Thursday, October 10, 2019 at 1:51:31 PM UTC-4, Irene Polikoff wrote: > > I am confused because it looks like the URI of the shapes graph is the > same as the URI of the data graph - <urn:x-evn-master:mytest> > > > > There would be nothing wrong with this, but you are showing different > triples under shapes and data graphs. > > > > Could you clarify: > > > > • Are you using the same graph as data and as shapes? > > • If you do, does this graph contain a merge of all the triples > you list below? > > • Or are you using two different graphs for shapes and data? > > • If so, does the data graph have access to rdfs:subClassOf > triple? > > > > Note the following under https://www.w3.org/TR/shacl/#targetClass > > > > Note that, according to the SHACL instance definition, all the > rdfs:subClassOf declarations needed to walk the class hierarchy need to > exist in the data graph. > > > > And under https://www.w3.org/TR/shacl/#data-graph > > > > The data graph is expected to include all the ontology axioms related to > the data and especially all the rdfs:subClassOf triples in order for SHACL > to correctly identify class targets and validate Core SHACL constraints. > > > > I believe having :dataGraph owl:imports :shapesGraph should be enough, > but leave it to Holger to confirm > > > >> On Oct 10, 2019, at 12:40 PM, Fan Li <[email protected]> wrote: > >> > >> Hi Irene, thanks for your prompt response! I should be more clear that > the error doesn't surface in the EDG editor interface but through the SHACL > validation form (/edg/tbl/swp?_viewClass=tblshacl%3AValidationPage) as well > as the public shacl playground (http://shacl.org). I have enclosed a > simple example for you to reproduce. > >> > >> shape: > >> # baseURI: urn:x-evn-master:mytest > >> # imports: http://datashapes.org/dash > >> # imports: http://datashapes.org/graphql > >> > >> @prefix mytest: <http://example.org/ontologies/mytest#> . > >> @prefix metadata: <http://topbraid.org/metadata#> . > >> @prefix sh: <http://www.w3.org/ns/shacl#> . > >> @prefix teamwork: <http://topbraid.org/teamwork#> . > >> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . > >> @prefix owl: <http://www.w3.org/2002/07/owl#> . > >> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . > >> <urn:x-evn-master:mytest> > >> a owl:Ontology ; > >> rdfs:label "mytest" ; > >> metadata:status metadata:UnderDevelopmentStatus ; > >> <http://topbraid.org/swa#defaultNamespace> > >> "http://example.org/ontologies/mytest#" ; > >> teamwork:newInstancesUserCannotModifyURI > >> false ; > >> owl:imports <http://datashapes.org/dash> , < > http://datashapes.org/graphql> . > >> > >> mytest:B a sh:NodeShape , owl:Class ; > >> rdfs:label "B" ; > >> rdfs:subClassOf owl:Thing . > >> > >> mytest:A a sh:NodeShape , owl:Class ; > >> rdfs:label "A" ; > >> rdfs:subClassOf mytest:B . > >> > >> mytest:C a sh:NodeShape , owl:Class ; > >> rdfs:label "C" ; > >> rdfs:subClassOf owl:Thing ; > >> sh:property mytest:C-prop1 . > >> > >> mytest:C-prop1 a sh:PropertyShape ; > >> sh:class mytest:B ; > >> sh:path mytest:prop1 . > >> > >> mytest:prop1 a owl:ObjectProperty ; > >> rdfs:label "prop1" . > >> > >> > >> data: > >> # baseURI: urn:x-evn-master:mytest > >> # imports: http://datashapes.org/dash > >> # imports: http://datashapes.org/graphql > >> > >> @prefix mytest: <http://example.org/ontologies/mytest#> . > >> @prefix metadata: <http://topbraid.org/metadata#> . > >> @prefix sh: <http://www.w3.org/ns/shacl#> . > >> @prefix teamwork: <http://topbraid.org/teamwork#> . > >> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . > >> @prefix owl: <http://www.w3.org/2002/07/owl#> . > >> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . > >> <urn:x-evn-master:mytest> > >> a owl:Ontology ; > >> rdfs:label "mytest" ; > >> metadata:status metadata:UnderDevelopmentStatus ; > >> <http://topbraid.org/swa#defaultNamespace> > >> "http://example.org/ontologies/mytest#" ; > >> teamwork:newInstancesUserCannotModifyURI > >> false ; > >> owl:imports <http://datashapes.org/dash> , < > http://datashapes.org/graphql> . > >> > >> mytest:34640a83-2c1b-11b2-80f2-005056bba47c > >> a mytest:A ; > >> rdfs:label "a1" . > >> > >> mytest:34640a85-2c1b-11b2-80f2-005056bba47c > >> a mytest:C ; > >> rdfs:label "c1" ; > >> mytest:prop1 mytest:34640a83-2c1b-11b2-80f2-005056bba47c . > >> > >> > >> > >> With regard to SHACL reference, I would be more than happy to know if > you have any recommendations. > >> > >> Thanks, > >> Fan > >> > >> On Thursday, October 10, 2019 at 12:09:24 PM UTC-4, Irene Polikoff > wrote: > >> Fan Li, > >> > >> If :X rdf:type :A, :A rdfs:subClassOf :B, :Y :prop1 :X and you have a > constraint :prop1 sh:class :B, you will NOT get a validation result. > >> > >> For example, if you look at one of the samples available for EDG - Geo > Taxonomy, you will not that most resources in that taxonomy are not of type > skos:Concept. Instead, they are members of classes Continent, City, etc., > which are declared as subclasses of skos:Concept. > >> > >> There is a constraint on skos:broader: > >> > >> skos:Concept-broader > >> a sh:PropertyShape ; > >> sh:path skos:broader ; > >> sh:class skos:Concept ; > >> sh:description "Relates a concept to a concept that is more general > in meaning."@en ; > >> sh:group skos:StandardRelationshipsPropertyGroup ; > >> sh:name "broader concept" ; > >> sh:order 0 ; > >> . > >> > >> Data has, for example: > >> > >> g:United_States > >> a g:Country ; > >> skos:broader g:North_America. > >> > >> g:North_America > >> a g:Continent. > >> > >> And there are no violations. SubclassOf entailment is always applied > automatically when sh:class constraints are evaluated and when target nodes > are calculated if class target is used. This is described in the spec: > >> > >> SHACL Type > >> The SHACL types of an RDF term in an RDF graph is the set of its values > for rdf:type in the graph as well as the SHACL superclasses of these values > in the graph. > >> > >> If you are having a problem, the issue is not with this logic. Are you > certain that the rdfs:subClassOf statement is present in the data graph? > How are you running the validation? > >> > >> Further, the book you are referencing has quite a number of > inaccuracies in its description of SHACL - some are more subtle than > others. > >> > >> I would not recommend it as a guide for understanding and using SHACL. > If you do so, chances are you will have some key misconceptions that would > prevent you from using SHACL effectively. > >> > >> Irene > >> > >>> On Oct 10, 2019, at 11:41 AM, Fan Li <[email protected]> wrote: > >>> > >>> Recently we encountered a situation where the validation error "Value > must be an instance of [some class]" is raised, even though the individual > has been declared an instance of a subclass of the class. We looked it up > and it seems the error is related to the lack of RDFS entailment in the > validation process: https://book.validatingrdf.com/bookHtml011.html#sec171 > >>> > >>> The referenced book also mentioned that entailment may be enabled > during the validation process. Is it possible within EDG? > >>> > >>> > >>> -- > >>> 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]. > >>> To view this discussion on the web visit > https://groups.google.com/d/msgid/topbraid-users/f4ad53ab-2f70-402c-8d4d-4b906ac5d69e%40googlegroups.com. > > > >> > >> > >> -- > >> 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]. > >> To view this discussion on the web visit > https://groups.google.com/d/msgid/topbraid-users/ef7c2a88-f029-43bd-9a80-ef4314110ed3%40googlegroups.com. > > > > > > > > -- > > 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] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/topbraid-users/0c03228c-b996-4102-b0f8-0cadb0078423%40googlegroups.com. > > > > <mytest.ttl> > > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/4fa66fa3-4a97-4174-a092-04aa256a54d4%40googlegroups.com.
