one jena-shacl question - was Re: two jena-shacl questions

2020-05-29 Thread Chris Tomlinson
Hi Andy,

Thank you for the reply. Focussing on just the first question. I have prepared 
small self-contained tests of jena-shacl from 3.14.0 (JS) and TopQuadrant Shacl 
1.3.2 (TQ).

The apps differ only according to differences imposed by the JS and TQ APIs:

ShaclName_validateGraphJS.java 

ShaclName_validateGraphTQ.java 


The DATA_P707.ttl  contains the three needed 
triples from the ontology and the bare minimum from the example P707 with two 
different errors in two of the PersonName instances.

The ShapeName_01.ttl  contains the shape 
definitions and all tests are performed only by changing the name on line 9.

The ShaclName_validateGraphJS-results-PersonShape.txt 
 shows the results when the JS app is run with 
the name bds:PersonShape and gives the expected results.

The ShaclName_validateGraphJS-results-PersonLocalShape… 
 shows the results when the JS app is run with 
the name bds:PersonLocalShape and gives unexpected results. Namely, the 
expected violation regarding the PersonName which uses skos:prefLabel instead 
of rdfs:label is erroneously reported as conforming.

The ShaclName_validateGraphJS-results-varying.txt 
 shows results for names ranging from “P”, “Pe”, 
“Per” thru “PersonLocal”, “PersonShape” upto “PersonLocalShape”, 
“PersonLocalShaper”, and finally “PersonLocalShapers” for the JS app. In the 
table a “0” means the unexpected result and a “1” means the expected result - 7 
names produce unexpected results and 20 names produce expected results.

The ShaclName_validateGraphTQ-results.txt  shows 
the results when the TQ app is run for any spelling of the name on line 9 of 
ShapeName_01.ttl . The results are the expected 
results as with some spellings of the name in the JS case. TQ shows no 
variation owing to the name on line 9 as is expected. 

(Note: The TQ engine needed to be re-initialized for each use otherwise it 
accumulated results. This is why there is an init of the ShaclSimpleValidator 
at each use in the JS app even though it is not needed. I just wanted to 
produce as much as possible an apples-to-apples comparison of JS and TQ.)

(Note: The TQ report does not include sh:conforms true ; in the results, just: 
[ a   sh:ValidationReport ] . I don’t know if this conforms to the SHACL 
spec but that’s another matter.)

The results from the command line tests show the same as the above.

Running  with line 9 of  ShapeName_01.ttl  set 
to bds:PersonLocalShape:

shacl v -s ShapeName_01.ttl -d DATA_P707.ttl > 
PersonLocalShape_JS_Results.ttl 

produces the unexpected results, namely there is no detail regarding the 
missing rdfs:label on bdr:NM0895CB6787E8AC6E.

However, running with line 9 of  ShapeName_01.ttl 
 set to bds:PersonShape:

shacl v -s ShapeName_01.ttl -d DATA_P707.ttl > PersonShape_JS_Results.ttl 


produces the expected results, in that the detail regarding the missing 
rdfs:label on bdr:NM0895CB6787E8AC6E is present among the results.

I did not set up the TQ command line but I think the above TQ results make this 
testing unnecessary.

I think these tests show that there is an unexpected dependence on a shape name 
in the JS library and not in the TQ library. I think this is an error and I can 
open a JIRA issue if appropriate. 

A consideration I have is that we want to be able to use the fuseki shacl 
endpoint for some processing and hence need to understand the expected behavior 
of the JS library which is integrated.

Thank you again for your help
Chris





> On May 29, 2020, at 6:26 AM, Andy Seaborne  wrote:
> 
>> Question 1: regarding the name  bds:PersonShape at line 9 of 
>> ShapeName_01.ttl . With that name the results 
>> of running ShaclName_validateGraph.java  are 
>> as expected, see ShapeName-results-PersonShape.txt 
>> .
>> There are two errors in P707_nameErrs02.ttl  
>> regarding bdr:NMC2A097019ABA499F and bdr:NM0895CB6787E8AC6E which are 
>> reported in the ShapeName-results-PersonShape.txt 
>>  file.
>> However, if the name at line 9 of ShapeName_01.ttl 
>>  is changed to: bds:PersonLocalShape or 
>> bds:Frogs; then detail for bdr:NM0895CB6787E8AC6E reports, (see 
>> ShapeName-results-PersonLocalShape.txt ):
>> [ a sh:ValidationReport ;
>>   sh:conforms true ] .
>> instead of:
>> [ ash:ValidationReport ;
>>   sh:conforms  false ;
>>   sh:result[ a 

Re: the problem of jar in the fuseki folder

2020-05-29 Thread Andy Seaborne

The binaries directory has:

http://archive.apache.org/dist/jena/binaries/apache-jena-fuseki-3.14.0.zip

(not the source code)

which has the file "apache-jena-fuseki-3.14.0/fuseki-server.jar" in it.

    Andy



 27019009  2020-01-05 17:24 apache-jena-fuseki-3.14.0/fuseki-server.jar


On 29/05/2020 13:19, 孙世俊 wrote:

Hi ,
 I have download the fuseki 3.14.0 , and  opened  the  
apache-jena-fuseki2  ,
  then i try to run the server  , but it remained me the problem of jar ,
  i don't know what can i do to handle this ?  So  may you give me some 
suggestion that how should i make it run ?

Thanks !






the problem of jar in the fuseki folder

2020-05-29 Thread 孙世俊
Hi , 
I have download the fuseki 3.14.0 , and  opened  the  
apache-jena-fuseki2  , 
 then i try to run the server  , but it remained me the problem of jar ,
 i don't know what can i do to handle this ?  So  may you give me some 
suggestion that how should i make it run ?

Thanks !






Re: two jena-shacl questions

2020-05-29 Thread Andy Seaborne




On 28/05/2020 20:47, Chris Tomlinson wrote:

Hi,

I have a two questions regarding behavior I’m seeing w/ jena-shacl in 3.14.0.

The data file is P707_nameErrs02.ttl , the shape graph is at 
ShapeName_01.ttl , and the test code is 
ShaclName_validateGraph.java .



Can we focus on one question please?

This is a complex setup and I'm not sure I have reproduced it correctly. 
With the ontology added, it isn't small.




Question 1: regarding the name  bds:PersonShape at line 9 of ShapeName_01.ttl 
. With that name the results of running 
ShaclName_validateGraph.java  are as expected, see 
ShapeName-results-PersonShape.txt .

There are two errors in P707_nameErrs02.ttl  regarding 
bdr:NMC2A097019ABA499F and bdr:NM0895CB6787E8AC6E which are reported in the 
ShapeName-results-PersonShape.txt  file.

However, if the name at line 9 of ShapeName_01.ttl  is 
changed to: bds:PersonLocalShape or bds:Frogs; then detail for bdr:NM0895CB6787E8AC6E 
reports, (see ShapeName-results-PersonLocalShape.txt ):

 [ a sh:ValidationReport ;
   sh:conforms true ] .

instead of:

[ ash:ValidationReport ;
   sh:conforms  false ;
   sh:result[ a sh:ValidationResult ;
  sh:focusNode  bdr:NM0895CB6787E8AC6E ;
  sh:resultMessage  ":PersonName must have exactly one 
rdfs:label"@en ;
  sh:resultPath rdfs:label ;
  sh:resultSeverity sh:Violation ;
  sh:sourceConstraintComponent  sh:MinCountConstraintComponent ;
  sh:sourceShape
bds:PersonNameShape-personNameLabel
]
] .

which is the result with bds:PersonShape at line 9 of ShapeName_01.ttl 
. In fact changing the name to bds:FrogTarts 
also produces the expected results.

Summary: If the shape name at line 9 of ShapeName_01.ttl 
 is either bds:PersonShape or bds:FrogTarts then 
the results are as expected; while if the shape name is either bds:PersonLocalShape 
or bds:Frogs then one of the detail results disappears and is replaced by  
sh:conforms true.

Why this dependence on the shape name? The shape name isn’t referred to elsewhere in 
ShapeName_01.ttl .



A way to check is run both Jena Shacl and TQ Shacl and see if they get 
the same violations


I ran the shapes and data in both and get 32 violations (with no 
ontology added)


and then running with the datafile as P707+ontology.  Now 5 results each.

shacl v -s ShapeName_01.ttl -d P707_nameErrs02.ttl > V1.ttl

tb-shacl -shapesfile ShapeName_01.ttl -datafile P707_nameErrs02.ttl

The name of the shape does not seem to make a difference when run like this.

Have you tries with targetNode to select the node to validate? With a 
subset of thee shapes? That would make discussing it much easier as 
would a self-contained data (the ontology isn't particularly small).


Do you have an example which has one target shape and shows differences?


This:

bds:PersonShape-personName
a   sh:PropertyShape ;
sh:classbdo:PersonName ;
sh:message  "PersonName is not well-formed, wrong Class or 
missing rdfs:label"@en ;

sh:minCount 1 ;
sh:node bds:PersonNameShape ;
sh:nodeKind sh:IRI ;
sh:path bdo:personName ;
.

(and others) could be split up into separate shapes, one per constraint 
(this has node kind, node shape, and minCount) which might make the 
report clearer


bds:PersonNameShape  also has a target - it can get called via two 
different routes.


It's quite complicated to track what's going on.





Question 2: With the same files as illustration, I’m wanting to understand how 
deep the:

 sv.validate(shapes, dataGraph, rez.asNode());

goes? What I mean is that simply calling:

 Model topReport = process(shapes, dataGraph, rez);


Since passing 'rez' is like choosing one node out of the target set, it 
is possible to write with targetNode - does this behave the same?




at line 74 of ShaclName_validateGraph.java  
produces just the result:



I get three separate reports all in one model, with 0, 1 and 2 violations.


[ ash:ValidationReport ;
   sh:conforms  false ;
   sh:result[ a sh:ValidationResult ;
  sh:focusNode  bdr:P707 ;
  sh:resultMessage  "PersonName is not well-formed, 
wrong Class or missing rdfs:label"@en ;
  sh:resultPath bdo:personName ;
   

Re: OWL inverseOf inference

2020-05-29 Thread Kenneth Keefe
Thank you very much! That worked!

Ken

On Fri, May 29, 2020 at 1:10 AM Lorenz Buehmann <
buehm...@informatik.uni-leipzig.de> wrote:

>
> On 29.05.20 01:50, Kenneth Keefe wrote:
> > So, the example I emailed earlier doesn't encapsulate the problem I'm
> > having with my production system. I've narrowed down the problem, but I
> am
> > at a loss for how to solve it. I need a way of combining reasoners or
> using
> > multiple reasoners on the same InfModel. Here is a snippet of code to
> help
> > explain:
> >
> > OntModel model =
> > ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
> > model.read("pr.owl");
> >
> > List rules = Rule.rulesFromURL("pr.rules");
> > Reasoner reasoner = new GenericRuleReasoner(rules);
> >
> > InfModel inf = ModelFactory.createInfModel(reasoner, model);
> >
> >
> > I have a pair of inverse object properties defined in pr.owl. If I add a
> > triplet with the property using inf.addProperty, the triplet is added to
> > model also and the OWL_MICRO reasoner infers the inverse property triple
> as
> > expected. Where I run into trouble is when one of my rules in pr.rules
> adds
> > a triplet to inf, that triplet is not added to model, and so the
> OWL_MICRO
> > reasoner doesn't see it.
> Your rule reasoner wraps the OWL Micro reasoner, so indeed the OWL Micro
> reasoner won't see inferred triples from the rule reasoner.
> >
> > What is the solution here? Can I define a composite Reasoner somehow?
> I've
> > scoured the inference documentation and don't see a solution.
>
> I guess the simplest way is to combine your rules with the OWL Micro
> rules [1] and just use the generic rule reasoner.
>
> IF you want to do it in Java code, you can also get the Micro rules by
> calling
>
> List microRules = OWLMicroReasoner.loadRules();
>
>
> [1]
>
> https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/owl-fb-micro.rules
>
> >
> > Ken
> >
> >
> > On Thu, May 28, 2020 at 4:16 PM Kenneth Keefe 
> wrote:
> >
> >> Thank you very much. That was indeed my mistake.
> >>
> >> Ken
> >>
> >> On Thu, May 28, 2020 at 4:10 PM Dave Reynolds <
> dave.e.reyno...@gmail.com>
> >> wrote:
> >>
> >>> On 28/05/2020 21:37, Kenneth Keefe wrote:
>  The Jena OWL Micro inference engine is not doing what I'm expecting
> when
>  faced with an objectProperty with an inverseOf statement. I explain a
>  simple test ontology and provide the owl and java to test it below.
> 
>  I created an ontology with a Person class and childOf and parentOf
> >>> object
>  properties. When I create two nodes and make one the parent of the
> >>> other,
>  I'm expecting the inference engine to infer the appropriate child
> >>> property,
>  but it doesn't.
> >>> General rule of thumb in such cases - check your URIs ...
> >>>
> >>> and, if at all possible, use turtle not RDF/XML, makes it easier to see
> >>> errors like this.
> >>>
>  inverseOf.owl
>  
>  http://example.com/ont/roster/;
>  xml:base="http://example.com/ont/roster/;
>  xmlns:pr="http://example.com/ont/roster/;
>  xmlns:owl="http://www.w3.org/2002/07/owl#;
>  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
>  xmlns:xml="http://www.w3.org/XML/1998/namespace;
>  xmlns:xsd="http://www.w3.org/2001/XMLSchema#;
>  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#;>
>  http://example.com/ont/inverse/;>
>    rdf:resource="http://example.com/ont/inverse/0.0.1; />
>  
> 
>  http://example.com/ont/inverse/Person; />
> 
>  http://example.com/ont/inverse/parentOf
> >>> ">
> http://example.com/ont/inverse/childOf;
> >>> />
> http://example.com/ont/inverse/Person;
> />
> http://example.com/ont/inverse/Person;
> />
>  
> >>> This declares an inverse of: http://example.com/ont/inverse/parentOf
> >>>
>  http://example.com/ont/inverse/childOf
> ">
> http://example.com/ont/inverse/Person;
> />
> http://example.com/ont/inverse/Person;
> />
>  
> 
>  http://example.com/ont/inverse/Sally;>
> http://example.com/ont/inverse/Person"/>
> http://example.com/ont/inverse/Bob; />
> >>> This uses a different relation from the one you meant, this uses:
> >>> http://example.com/ont/roster/parentOf
> >>>
>  
> 
>  http://example.com/ont/inverse/Bob;>
> http://example.com/ont/inverse/Person"/>
>  
> 
>  
> 
>  Here is the Jena code I use:
> 
>  OntModel model =
> 
> >>>  ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
>  model.read("file:///inverseTest.owl");
> 
>  printAllStatements(model);
> 
>  The resulting model contains these nodes with Bob or Sally as the
> >>> subject:
>  http://example.com/ont/inverse/Bob
>  http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>  http://example.com/ont/inverse/Person .
>  http://example.com/ont/inverse/Bob
>  

Re: OWL inverseOf inference

2020-05-29 Thread Lorenz Buehmann

On 29.05.20 01:50, Kenneth Keefe wrote:
> So, the example I emailed earlier doesn't encapsulate the problem I'm
> having with my production system. I've narrowed down the problem, but I am
> at a loss for how to solve it. I need a way of combining reasoners or using
> multiple reasoners on the same InfModel. Here is a snippet of code to help
> explain:
>
> OntModel model =
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
> model.read("pr.owl");
>
> List rules = Rule.rulesFromURL("pr.rules");
> Reasoner reasoner = new GenericRuleReasoner(rules);
>
> InfModel inf = ModelFactory.createInfModel(reasoner, model);
>
>
> I have a pair of inverse object properties defined in pr.owl. If I add a
> triplet with the property using inf.addProperty, the triplet is added to
> model also and the OWL_MICRO reasoner infers the inverse property triple as
> expected. Where I run into trouble is when one of my rules in pr.rules adds
> a triplet to inf, that triplet is not added to model, and so the OWL_MICRO
> reasoner doesn't see it.
Your rule reasoner wraps the OWL Micro reasoner, so indeed the OWL Micro
reasoner won't see inferred triples from the rule reasoner.
>
> What is the solution here? Can I define a composite Reasoner somehow? I've
> scoured the inference documentation and don't see a solution.

I guess the simplest way is to combine your rules with the OWL Micro
rules [1] and just use the generic rule reasoner.

IF you want to do it in Java code, you can also get the Micro rules by
calling

List microRules = OWLMicroReasoner.loadRules();


[1]
https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/owl-fb-micro.rules

>
> Ken
>
>
> On Thu, May 28, 2020 at 4:16 PM Kenneth Keefe  wrote:
>
>> Thank you very much. That was indeed my mistake.
>>
>> Ken
>>
>> On Thu, May 28, 2020 at 4:10 PM Dave Reynolds 
>> wrote:
>>
>>> On 28/05/2020 21:37, Kenneth Keefe wrote:
 The Jena OWL Micro inference engine is not doing what I'm expecting when
 faced with an objectProperty with an inverseOf statement. I explain a
 simple test ontology and provide the owl and java to test it below.

 I created an ontology with a Person class and childOf and parentOf
>>> object
 properties. When I create two nodes and make one the parent of the
>>> other,
 I'm expecting the inference engine to infer the appropriate child
>>> property,
 but it doesn't.
>>> General rule of thumb in such cases - check your URIs ...
>>>
>>> and, if at all possible, use turtle not RDF/XML, makes it easier to see
>>> errors like this.
>>>
 inverseOf.owl
 
 http://example.com/ont/roster/;
 xml:base="http://example.com/ont/roster/;
 xmlns:pr="http://example.com/ont/roster/;
 xmlns:owl="http://www.w3.org/2002/07/owl#;
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
 xmlns:xml="http://www.w3.org/XML/1998/namespace;
 xmlns:xsd="http://www.w3.org/2001/XMLSchema#;
 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#;>
 http://example.com/ont/inverse/;>
 >>> rdf:resource="http://example.com/ont/inverse/0.0.1; />
 

 http://example.com/ont/inverse/Person; />

 http://example.com/ont/inverse/parentOf
>>> ">
http://example.com/ont/inverse/childOf;
>>> />
http://example.com/ont/inverse/Person; />
http://example.com/ont/inverse/Person; />
 
>>> This declares an inverse of: http://example.com/ont/inverse/parentOf
>>>
 http://example.com/ont/inverse/childOf;>
http://example.com/ont/inverse/Person; />
http://example.com/ont/inverse/Person; />
 

 http://example.com/ont/inverse/Sally;>
http://example.com/ont/inverse/Person"/>
http://example.com/ont/inverse/Bob; />
>>> This uses a different relation from the one you meant, this uses:
>>> http://example.com/ont/roster/parentOf
>>>
 

 http://example.com/ont/inverse/Bob;>
http://example.com/ont/inverse/Person"/>
 

 

 Here is the Jena code I use:

 OntModel model =

>>>  ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
 model.read("file:///inverseTest.owl");

 printAllStatements(model);

 The resulting model contains these nodes with Bob or Sally as the
>>> subject:
 http://example.com/ont/inverse/Bob
 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
 http://example.com/ont/inverse/Person .
 http://example.com/ont/inverse/Bob
 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
 http://www.w3.org/2000/01/rdf-schema#Resource .
 http://example.com/ont/inverse/Bob
 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
 http://www.w3.org/2002/07/owl#Thing .
 http://example.com/ont/inverse/Sally
>>> http://example.com/ont/roster/parentOf
 http://example.com/ont/inverse/Bob .
 http://example.com/ont/inverse/Sally
 http://www.w3.org/1999/02/22-rdf-syntax-ns#type