4 Replies Latest reply: Jun 13, 2013 2:00 AM by wooodini RSS

    Oracle property path and arq property functions

    wooodini

      Hi,

      I am using Oracle Jena Adapter. My problem is about property paths on Sparql queries. When I tried to query ”SELECT * WHERE { ?t rdf:type owl:ObjectProperty. ?t rdfs:domain ?o. ?o owl:unionOf ?union. ?union rdf:rest*/rdf:first ?member. }” from ModelOracleSem it gives me parser error.

      But, if i try it using jena in-memory model, it works perfectly as below code.

      hybridGraph = OracleGraphWrapperForOntModel.getInstance(graph1);

      model = ModelFactory.createModelForGraph(hybridGraph);

      ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, model);

       

      I also tried arq’s list function as “?union list:member ?member”. it does not return any results from ModelOracleSem. But when i try it from jena in-memory model, it works perfectly again.
        

      Can anyone help me to solve this issue?


      Thanks,

      Regards,

        • 1. Re: Oracle property path and arq property functions
          alwu-Oracle

          Hi Wooodini,

           

          Could you please cut & paste here the exact error messages?

           

          Thanks,

           

          Zhe Wu

          • 2. Re: Oracle property path and arq property functions
            wooodini

            Hi Zhe,

            You can see the exact error message below.

            Thanks,

            Mustafa

             

            2013-06-10 16:54:42 message: java.sql.SQLException: ORA-29532: Java çağrısı, yakalanmayan Java istisnası ile sonlandırıldı: oracle.spatial.rdf.server.ParseException: Encountered "<" at line 1, column 2.

            Was expecting one of:

                <URI> ...

                <QNAME> ...

                <VAR> ...

            ORA-06512: konum "MDSYS.RDF_MATCH_IMPL_T",  satır 203

            ORA-06512: konum "MDSYS.RDF_MATCH_IMPL_T",  satır 67

            ORA-06512: konum  satır 4

             

            Message was edited by: wooodini Extra information: if I change the query as `?union rdf:rest/rdf:first ?member.` (without *) it is working. But, if I change it as`?union rdf:rest* ?member.` or `?union rdf:rest+ ?member.`,  it gives me the same error.

            • 3. Re: Oracle property path and arq property functions
              gmontiel

              Hi Mustafa,

               

              We have generated the following code snippet to execute the SPARQL query using a ModelOracleSem model:

               

              String szQuery = " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "+

                           " PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#> " +

                           " PREFIX owl:   <http://www.w3.org/2002/07/owl#> " +

                          " select * where { " +

                          " ?t rdf:type owl:ObjectProperty . " +

                          " ?t rdfs:domain ?o . " +

                          " ?o owl:unionOf ?union . " +

                          " ?union rdf:rest*/rdf:first ?member ." +

                          " }";

               

                  System.err.println("Create Oracle Connection");

                  Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);

                 

                  System.err.println("Create Oracle Model");

                  ModelOracleSem oracleModel = ModelOracleSem.createOracleSemModel(

                                                                          oracle, szModelName);

                 

                  oracleModel.removeAll();

                 

                  System.err.println("Populate model");

                  String insertString = 

                          " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "+

                          " PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#> " +

                          " PREFIX owl:   <http://www.w3.org/2002/07/owl#> " +

                          " PREFIX urn:   <http://example/> " +

                          " INSERT DATA "                                     +

                          " { urn:objA rdf:type owl:ObjectProperty .                " +

                          "   urn:objB rdf:type owl:ObjectProperty .                " +

                          "   urn:objC rdf:type owl:ObjectProperty .                " +

                          "   urn:objD rdf:type owl:ObjectProperty .                " +

                          "   urn:objA rdfs:domain urn:dom1 .                " +

                          "   urn:objB rdfs:domain urn:dom2 .                " +

                          "   urn:objC rdfs:domain urn:dom3 .                " +

                          "   urn:objD rdfs:domain urn:dom4 .                " +

                          "   urn:dom1 owl:unionOf _:setA .                " +

                          "   _:setA rdf:rest _:mem1 .                " +

                          "   _:setA rdf:first urn:C1 .                " +

                          "   _:mem1 rdf:first urn:C2 .                " +

                          "   _:mem1 rdf:rest rdf:nil .                " +

                          " }   ";

                  UpdateAction.parseExecute(insertString,  oracleModel);

                  System.err.println("Population done " + oracleModel.size());

                 

                  System.err.println("Execute query over OracleModel");

                  Query query = QueryFactory.create(szQuery, Syntax.syntaxARQ);

                  QueryExecution qexec = QueryExecutionFactory.create(query, oracleModel);

                  ResultSet results = qexec.execSelect();

                  ResultSetFormatter.out(System.out, results, query);

               

              Can you execute this code snippet and see if you get the expected result?

               

              -------------------------------------------------------------------------------

              | t                     | o                     | union | member              |

              ===============================================================================

              | <http://example/objA> | <http://example/dom1> | _:b0  | <http://example/C1> |

              | <http://example/objA> | <http://example/dom1> | _:b0  | <http://example/C2> |

              -------------------------------------------------------------------------------

               

              Thanks,

               

              Gaby

              • 4. Re: Oracle property path and arq property functions
                wooodini

                Hi Gaby,

                I tried it and it worked. Strangely, after running your example, i also tried my code again it worked. I could not understand the reason.

                Anyway thanks.

                 

                Regards,

                Mustafa