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

    https://github.com/apache/incubator-rya/pull/215#discussion_r135109057
  
    --- Diff: extras/indexingExample/src/main/java/MongoRyaDirectExample.java 
---
    @@ -572,6 +573,108 @@ public static void testAllValuesFromInference(final 
SailRepositoryConnection con
             Validate.isTrue(resultHandler.getCount() == 2);
         }
     
    +    public static void testOneOfInference(final SailRepositoryConnection 
conn, final Sail sail) throws MalformedQueryException, RepositoryException, 
UpdateExecutionException, QueryEvaluationException, 
TupleQueryResultHandlerException, InferenceEngineException {
    +        log.info("Adding Data");
    +        final String instances = "INSERT DATA"
    +                + "{ GRAPH <http://updated/test> {\n"
    +                + "  <urn:FlopCard1> a <urn:Card> . \n"
    +                + "    <urn:FlopCard1> <urn:HasRank> <urn:Ace> . \n"
    +                + "    <urn:FlopCard1> <urn:HasSuit> <urn:Diamonds> . \n"
    +                + "  <urn:FlopCard2> a <urn:Card> . \n"
    +                + "    <urn:FlopCard2> <urn:HasRank> <urn:Ace> . \n"
    +                + "    <urn:FlopCard2> <urn:HasSuit> <urn:Hearts> . \n"
    +                + "  <urn:FlopCard3> a <urn:Card> . \n"
    +                + "    <urn:FlopCard3> <urn:HasRank> <urn:King> . \n"
    +                + "    <urn:FlopCard3> <urn:HasSuit> <urn:Spades> . \n"
    +                + "  <urn:TurnCard> a <urn:Card> . \n"
    +                + "    <urn:TurnCard> <urn:HasRank> <urn:10> . \n"
    +                + "    <urn:TurnCard> <urn:HasSuit> <urn:Clubs> . \n"
    +                + "  <urn:RiverCard> a <urn:Card> . \n"
    +                + "    <urn:RiverCard> <urn:HasRank> <urn:Queen> . \n"
    +                + "    <urn:RiverCard> <urn:HasSuit> <urn:Hearts> . \n"
    +                + "}}";
    +        Update update = conn.prepareUpdate(QueryLanguage.SPARQL, 
instances);
    +        update.execute();
    +        final String explicitQuery = "select distinct ?card { GRAPH 
<http://updated/test> {\n"
    +                + "  ?card a <urn:Card> . \n"
    +                + "  VALUES ?suit { <urn:Clubs> <urn:Diamonds> 
<urn:Hearts> <urn:Spades> } . \n"
    +                + "  ?card <urn:HasSuit> ?suit . \n"
    +                + "}}";
    +        log.info("Running Explicit Query");
    +        CountingResultHandler resultHandler = new CountingResultHandler();
    +        TupleQuery tupleQuery = 
conn.prepareTupleQuery(QueryLanguage.SPARQL, explicitQuery);
    +        tupleQuery.evaluate(resultHandler);
    +        log.info("Result count : " + resultHandler.getCount());
    +        Validate.isTrue(resultHandler.getCount() == 5);
    +        log.info("Adding owl:oneOf Schema");
    +        // ONTOLOGY - :Suits oneOf (:Clubs, :Diamonds, :Hearts, :Spades)
    +        // ONTOLOGY - :Ranks oneOf (:Ace, :1, :2, :3, :4, :5, :6, :7, :8, 
:9, :10, :Jack, :Queen, :King)
    +        final String ontology = "INSERT DATA { GRAPH <http://updated/test> 
{\n"
    +                + "  <urn:Suits> owl:oneOf _:bnodeS1 . \n"
    +                + "  _:bnodeS1 rdf:first <urn:Clubs> . \n"
    +                + "  _:bnodeS1 rdf:rest _:bnodeS2 . \n"
    +                + "  _:bnodeS2 rdf:first <urn:Diamonds> . \n"
    +                + "  _:bnodeS2 rdf:rest _:bnodeS3 . \n"
    +                + "  _:bnodeS3 rdf:first <urn:Hearts> . \n"
    +                + "  _:bnodeS3 rdf:rest _:bnodeS4 . \n"
    +                + "  _:bnodeS4 rdf:first <urn:Spades> . \n"
    +                + "  _:bnodeS4 rdf:rest rdf:nil . \n"
    +                + "  <urn:Ranks> owl:oneOf _:bnodeR1 . \n"
    +                + "  _:bnodeR1 rdf:first <urn:Ace> . \n"
    +                + "  _:bnodeR1 rdf:rest _:bnodeR2 . \n"
    +                + "  _:bnodeR2 rdf:first <urn:2> . \n"
    +                + "  _:bnodeR2 rdf:rest _:bnodeR3 . \n"
    +                + "  _:bnodeR3 rdf:first <urn:3> . \n"
    +                + "  _:bnodeR3 rdf:rest _:bnodeR4 . \n"
    +                + "  _:bnodeR4 rdf:first <urn:4> . \n"
    +                + "  _:bnodeR4 rdf:rest _:bnodeR5 . \n"
    +                + "  _:bnodeR5 rdf:first <urn:5> . \n"
    +                + "  _:bnodeR5 rdf:rest _:bnodeR6 . \n"
    +                + "  _:bnodeR6 rdf:first <urn:6> . \n"
    +                + "  _:bnodeR6 rdf:rest _:bnodeR7 . \n"
    +                + "  _:bnodeR7 rdf:first <urn:7> . \n"
    +                + "  _:bnodeR7 rdf:rest _:bnodeR8 . \n"
    +                + "  _:bnodeR8 rdf:first <urn:8> . \n"
    +                + "  _:bnodeR8 rdf:rest _:bnodeR9 . \n"
    +                + "  _:bnodeR9 rdf:first <urn:9> . \n"
    +                + "  _:bnodeR9 rdf:rest _:bnodeR10 . \n"
    +                + "  _:bnodeR10 rdf:first <urn:10> . \n"
    +                + "  _:bnodeR10 rdf:rest _:bnodeR11 . \n"
    +                + "  _:bnodeR11 rdf:first <urn:Jack> . \n"
    +                + "  _:bnodeR11 rdf:rest _:bnodeR12 . \n"
    +                + "  _:bnodeR12 rdf:first <urn:Queen> . \n"
    +                + "  _:bnodeR12 rdf:rest _:bnodeR13 . \n"
    +                + "  _:bnodeR13 rdf:first <urn:King> . \n"
    +                + "  _:bnodeR13 rdf:rest rdf:nil . \n"
    +                + "  <urn:Card> rdfs:equivalentClass [\n"
    +                + "    owl:onProperty <urn:HasRank> ; owl:range 
<urn:Ranks> ;\n"
    +                + "    owl:onProperty <urn:HasSuit> ; owl:range 
<urn:Suits> ;\n"
    +                + "  ] . \n"
    --- End diff --
    
    I replaced with the intersectionOf example and added separate range 
statements for HasRank and HasSuit.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to