[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16133876#comment-16133876
 ] 

ASF GitHub Bot commented on RYA-295:


Github user asfgit closed the pull request at:

https://github.com/apache/incubator-rya/pull/201


> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16133858#comment-16133858
 ] 

ASF GitHub Bot commented on RYA-295:


Github user asfgit commented on the issue:

https://github.com/apache/incubator-rya/pull/201
  

Refer to this link for build results (access rights to CI server needed): 

https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/415/



> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16133190#comment-16133190
 ] 

ASF GitHub Bot commented on RYA-295:


Github user asfgit commented on the issue:

https://github.com/apache/incubator-rya/pull/201
  

Refer to this link for build results (access rights to CI server needed): 

https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/411/Build
 result: FAILURE[...truncated 222.12 KB...][INFO] 
[INFO] 
Total time: 05:50 min[INFO] Finished at: 2017-08-18T16:08:52+00:00[INFO] Final 
Memory: 114M/3031M[INFO] 
[ERROR] 
Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on 
project rya.sail: Compilation failure: Compilation failure:[ERROR] 
/home/jenkins/jenkins-slave/workspace/incubator-rya-master-with-optionals-pull-requests/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java:[998,5]
 illegal start of expression[ERROR] 
/home/jenkins/jenkins-slave/workspace/incubator-rya-master-with-optionals-pull-requests/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java:[998,63]
 ';' expected[ERROR] 
/home/jenkins/jenkins-slave/workspace/incubator-rya-master-with-optionals-pull-requests/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java:[998,82]
 ';' expected[ERROR] 
/home/jenkins/jenkins-slave/workspace/incubator-rya-master-with-optionals-pull-requests/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java:[1024,2]
 reached end of file while parsing[ERROR] -> [Help 1][ERROR] [ERROR] To see the 
full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run 
Maven using the -X switch to enable full debug logging.[ERROR] [ERROR] For more 
information about the errors and possible solutions, please read the following 
articles:[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the 
command[ERROR]   mvn  -rf :rya.sailchannel stoppedSetting status of 
89747b21f680643216466158dcb779940822cc93 to FAILURE with url 
https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/411/
 and message: 'FAILURE 'Using context: Jenkins: clean package -Pgeoindexing



> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValues>From 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16131206#comment-16131206
 ] 

ASF GitHub Bot commented on RYA-295:


Github user meiercaleb commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/201#discussion_r133811286
  
--- Diff: 
sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java 
---
@@ -416,6 +418,36 @@ private void refreshHasValueRestrictions(Map restrictions) throws
 }
 }
 
+private void refreshAllValuesFromRestrictions(Map 
restrictions) throws QueryEvaluationException {
--- End diff --

I think it would be good to outline the flow of logic here.  E.g. refreshes 
allValuesRestrictions by creating a map of maps from the value class to a map 
that associates restrictions with properties.  


> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126480#comment-16126480
 ] 

ASF GitHub Bot commented on RYA-295:


Github user asfgit commented on the issue:

https://github.com/apache/incubator-rya/pull/201
  

Refer to this link for build results (access rights to CI server needed): 

https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/390/Failed
 Tests: 3incubator-rya-master-with-optionals-pull-requests/org.apache.rya:rya.prospector:
 3org.apache.rya.prospector.mr.ProspectorTest.testCountorg.apache.rya.prospector.service.ProspectorServiceEvalStatsDAOTest.testCountorg.apache.rya.prospector.service.ProspectorServiceEvalStatsDAOTest.testNoAuthsCount



> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValues>From 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126460#comment-16126460
 ] 

ASF GitHub Bot commented on RYA-295:


Github user jessehatfield commented on the issue:

https://github.com/apache/incubator-rya/pull/201
  
Fixed a typo in a log message and a redundant line in the example; updated 
with latest changes to master.


> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16119046#comment-16119046
 ] 

ASF GitHub Bot commented on RYA-295:


Github user asfgit commented on the issue:

https://github.com/apache/incubator-rya/pull/201
  

Refer to this link for build results (access rights to CI server needed): 

https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/373/



> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16119001#comment-16119001
 ] 

ASF GitHub Bot commented on RYA-295:


GitHub user jessehatfield opened a pull request:

https://github.com/apache/incubator-rya/pull/201

RYA-295 owl:allValuesFrom inference


## Description
Inference applies owl:allValuesFrom semantics for queries including 
statement patterns of the form "?x rdf:type :DefinedClass".

An owl:allValuesFrom property restriction is a universal class expression: 
it defines type T1 to be the set of individuals such that, for a given property 
p and type T2, all values of that property (i.e. all objects of triples where 
the predicate is p and the subject belongs to T1) have type T2. Therefore, if 
an individual is known to belong to the universal class expression (T1), then 
it can be inferred that all of its values for the property belong to the value 
type (T2). This is similar to rdfs:range except that it only applies when the 
subject of the triple belongs to the appropriate class expression.

InferenceEngine, at refresh time, stores information about 
owl:allValuesFrom restrictions (universal class expressions). These definitions 
can then be accessed by the value type: getAllValuesFromByValueType() returns every (restriction type, property) pair.

AllValuesFromVisitor processes statement patterns of the form "?x rdf:type 
:T2", and if :T2 is the value type for any owl:allValuesFrom restriction 
according to the inference engine, it replaces the statement pattern with a 
union: of 1) that same statement pattern (in case the type is explicitly 
asserted or can be inferred by some other rule); and 2) a subquery of the form 
"?y \:p ?x . ?y rdf:type :T1" for the appropriate (restriction type, property) 
pair.

RdfCloudTripleStoreConnection calls the visitor along with the other 
inference logic. Because the original statement pattern is preserved as one 
branch of the union, other visitors can still apply if there are other ways to 
derive the type.

Added a simple example of a query that relies on this inference to 
MongoRyaDirectExample.

### Tests
Unit test to verify that InferenceEngine stores and returns the schema; 
unit test to verify that AllValuesFromVisitor rewrites queries of the proper 
form; integration test to verify correct results for sample 
ontology+instances+query relying on allValuesFrom inference.

### Links
[Jira](https://issues.apache.org/jira/browse/RYA-295)

### Checklist
- [ ] Code Review
- [ ] Squash Commits

 People To Reivew
@ejwhite922 
@isper3at 
@meiercaleb 
@pujav65 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jessehatfield/incubator-rya 
RYA-295-allValuesFrom-inference

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-rya/pull/201.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #201


commit 55eae37e2f4aaef2f8cd41c735241c2ae85b88af
Author: Jesse Hatfield 
Date:   2017-08-08T19:58:10Z

RYA-295 owl:allValuesFrom inference




> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with 

[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-08-04 Thread Jesse Hatfield (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16114840#comment-16114840
 ] 

Jesse Hatfield commented on RYA-295:


Alternatively, we could use FixedStatementPattern to enumerate 
predicate/restriction pairs rather than nested unions. Something like:
{noformat}
Join(FSP, Join(StatementPattern(?subject, ?property, ?object), 
StatementPattern(?subject, rdf:type ?restriction)))
{noformat}
where FSP provides bindings for {{?property}} and {{?restriction}}:
{noformat}
FixedStatementPattern(?restriction, owl:onProperty, ?property):
(:r1, onProperty, :p1)
(:r2, onProperty, :p2)
...
(:rN, onProperty, :pN)
{noformat}
In this case, the number of nodes in the query tree is bounded; additional 
restrictions implying the same type are represented as statements in the 
FixedStatementPattern. One top-level Union is still needed to include the 
original statement pattern.

> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RYA-295) Implement owl:allValuesFrom inference

2017-07-18 Thread Jesse Hatfield (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16092144#comment-16092144
 ] 

Jesse Hatfield commented on RYA-295:


In general, if we have{quote}:A owl:onProperty :p .
:A owl:allValuesFrom :B {quote}
then this means:{quote}x is an A *if and only if*, for all y, *if* (x p y) 
*then* y is a B.{quote}
As described above, we can never deduce the second half ("for all y, if ... 
then") just from the data, because of the open-world assumption. Therefore the 
only implication we need to consider is
bq. *If* x is an A *then* for all y, *if* (x p y) *then* y is a B.
Equivalently:
bq. *If* there exists some x *such that* (x is an A) AND (x p y) *then* y is a 
B.
This is the same kind of expression we can derive from owl:someValuesFrom, 
described in [RYA-294], but in the reverse direction: inferring the object's 
type if there exist some subject who has it as a value.

We can use the same approach. In the inference engine:
{code}allValuesFromByValueType <- Map
for (restrictionType, property) in propertyRestrictions:
for valueType in query(property owl:allValuesFrom ?valueType):
allValuesFromByValueType[valueType][property] <- restrictionType
...
getAllValuesFromImplying(type): // return (property, restriction type) pairs 
that would imply this type
results <- List<(property, restrictionType)>
for sufficientType <- type UNION getAllSubClasses(type):
if sufficientType in allValuesFromByValueType:
results.addAll(allValuesFromByValueType[sufficientType])
return results{code}
And a visitor:
{code}meet(StatementPattern originalSP):
if originalSP like (?object rdf:type :C1): // Assume the type in question 
is explicitly given in the query, not a variable
node <- originalSP
for (property, restrictionType) in 
inferenceEngine.getAllValuesFromImplying(C1):
option <- InferJoin(StatementPattern(?subject, property, ?object), 
StatementPattern(?subject, rdf:type, restrictionType))
node <- InferUnion(node, option)
originalSP.replaceWith(node){code}

> Implement owl:allValuesFrom inference
> -
>
> Key: RYA-295
> URL: https://issues.apache.org/jira/browse/RYA-295
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>
> An *{{owl:allValuesFrom}}* restriction defines the set of resources for 
> which, given a particular predicate and other type, every value of that 
> predicate is a member of that type. Note that there may be no values at all.
> For example, the ontology may state that resources of type {{:Person}} have 
> all values from {{:Person}} for type {{:parent}}: that is, a person's parents 
> are all people as well. Therefore, a pattern of the form {{?x rdf:type 
> :Person}} should be expanded to:
> {noformat}
> { ?y rdf:type :Person .
>   ?y :parent ?x }
> UNION
> { ?x rdf:type :Person }
> {noformat}
> i.e. we can infer {{?x}}'s personhood from the fact that child {{?y}} is 
> known to satisfy the restriction.
> Notes:
> -We can infer "x is a person, therefore all of x's parents are people". But 
> we can't infer "all of x's parents are people, therefore x is a person", 
> because of the open world semantics: we don't know that the parents given by 
> the data are in fact all of x's parents. (If there were also a cardinality 
> restriction and we could presume consistency, then we could infer this in the 
> right circumstances, but this is outside the scope of basic allValuesFrom 
> support.) This differs with most other property restriction rules in that we 
> can't infer that an object belongs to the class defined by the restriction, 
> but rather use the fact that an object is already known to belong in that 
> class in order to infer something about its neighbors in the graph (the types 
> of the values).
> -The example above could be applied recursively, but to implement this as a 
> simple query rewrite we'll need to limit recursion depth (and interactions 
> with other rules, for the same reasons).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)