4 Replies Latest reply on Jan 15, 2009 2:52 PM by alwu-Oracle

    LUBM SPARQL query defect - Semantic Tech

    649337
      Dear friends,

      We're doing test the performance of triple load and query in Oracle 11g.
      The tool we are using is the LUBM, please refer to: http://swat.cse.lehigh.edu/projects/lubm/
      This tool has 14 queries, checking inference and query evaluation speed.
      The obviouse defect can be found from the result of 7th SPARQL query.

      [query7]
      PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      PREFIX ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
      SELECT ?X ?Y
      WHERE {
      <http://www.Department0.University0.edu/AssociateProfessor0> ub:teacherOf ?Y .
      ?Y rdf:type ub:Course .
      ?X ub:takesCourse ?Y .
      ?X rdf:type ub:Student
      }

      By using Oracle as the triple store, we can only have 20 rows of result for this query.


      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------
      http://www.Department0.University0.edu/GraduateStudent56
      http://www.Department0.University0.edu/GraduateCourse13

      http://www.Department0.University0.edu/UndergraduateStudent41
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent138
      http://www.Department0.University0.edu/Course16


      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------
      http://www.Department0.University0.edu/UndergraduateStudent201
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent184
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent249
      http://www.Department0.University0.edu/Course16


      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------
      http://www.Department0.University0.edu/UndergraduateStudent190
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent219
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent161
      http://www.Department0.University0.edu/Course16


      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------
      http://www.Department0.University0.edu/UndergraduateStudent1
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent293
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent222
      http://www.Department0.University0.edu/Course16


      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------
      http://www.Department0.University0.edu/GraduateStudent70
      http://www.Department0.University0.edu/GraduateCourse13

      http://www.Department0.University0.edu/UndergraduateStudent306
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent44
      http://www.Department0.University0.edu/Course16


      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------
      http://www.Department0.University0.edu/UndergraduateStudent183
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/UndergraduateStudent179
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/GraduateStudent25
      http://www.Department0.University0.edu/GraduateCourse12


      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------
      http://www.Department0.University0.edu/UndergraduateStudent155
      http://www.Department0.University0.edu/Course16

      http://www.Department0.University0.edu/GraduateStudent115
      http://www.Department0.University0.edu/GraduateCourse12


      20 rows selected.

      But in fact, we should have 22 rows of result for this query.
      The two rows were not queried out by Oracle are:

      X
      --------------------------------------------------------------------------------
      Y
      --------------------------------------------------------------------------------

      http://www.Department0.University0.edu/GraduateCourse13
      http://www.Department0.University0.edu/GraduateStudent64
           
      http://www.Department0.University0.edu/GraduateCourse13
      http://www.Department0.University0.edu/GraduateStudent114     

      Actually, when we lookinto the raw data which is loaded into Oracle, these two entities are obviousely here:

      1)
      <ub:GraduateStudent rdf:about="http://www.Department0.University0.edu/GraduateStudent64">
      <ub:name>GraduateStudent64</ub:name>
      <ub:memberOf rdf:resource="http://www.Department0.University0.edu" />
      <ub:emailAddress>GraduateStudent64@Department0.University0.edu</ub:emailAddress>
      <ub:telephone>xxx-xxx-xxxx</ub:telephone>
      <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse37" />
      <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse11" />
      <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse13" />
      <ub:undergraduateDegreeFrom>
      <ub:University rdf:about="http://www.University708.edu" /> </ub:undergraduateDegreeFrom>
      <ub:advisor rdf:resource="http://www.Department0.University0.edu/AssistantProfessor3" />
      </ub:GraduateStudent>

      2)
      <ub:GraduateStudent rdf:about="http://www.Department0.University0.edu/GraduateStudent114">
      <ub:name>GraduateStudent114</ub:name>
      <ub:memberOf rdf:resource="http://www.Department0.University0.edu" />
      <ub:emailAddress>GraduateStudent114@Department0.University0.edu</ub:emailAddress>
      <ub:telephone>xxx-xxx-xxxx</ub:telephone>
      <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse6" />
      <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse13" />
      <ub:undergraduateDegreeFrom>
      <ub:University rdf:about="http://www.University782.edu" /> </ub:undergraduateDegreeFrom>
      <ub:advisor rdf:resource="http://www.Department0.University0.edu/FullProfessor3" />
      </ub:GraduateStudent>

      This kind of defect also happened for 6th query, 8th query and 9th query. Because the output of these queries is too large, so we can't check them manually one by one. (May I don't know there is other way to check the correctness of the result.)

      As you can see the above simple query can not give the right answer, we are really doubt the correctness of other queries given by Oracle.

      Does anyone could tell me why this happened? Is there any way to fix that?
      Many thanks in advance.

      Regards,
      Bryan
        • 1. Re: LUBM SPARQL query defect - Semantic Tech
          Mannamal-Oracle
          Are you using any inferencing? If so, that might a reason for the behavior you are observing. Oracle's OWL support (OWL Prime) does not include some OWL constructs. It is a subset of OWL DL. Information on this subset and how to model other constructs is available at the "inference Best Practices with RDFS/OWL" available at http://www.oracle.com/technology/tech/semantic_technologies/index.html .

          Melli
          • 2. Re: LUBM SPARQL query defect - Semantic Tech
            649337
            Thanks for you reply Melli.

            Yes, we have done inference followed the best practices direction. The data generated by using Jena include the ontology file, please refer to: http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl

            The rulebase is OWLPRIME.

            If you think the reason is the inference, so I'm curious about why Oracle could find out GraduateStudent70 but can not find out GraduateStudent64?
            Do you think is there any differences between entity GraduateStudent64 and entity GraduateStudent70?
            They both take course GraduateCourse13 !

            GraduateStudent64
            <ub:GraduateStudent rdf:about="http://www.Department0.University0.edu/GraduateStudent64">
            <ub:name>GraduateStudent64</ub:name>
            <ub:memberOf rdf:resource="http://www.Department0.University0.edu" />
            <ub:emailAddress>GraduateStudent64@Department0.University0.edu</ub:emailAddress>
            <ub:telephone>xxx-xxx-xxxx</ub:telephone>
            <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse37" />
            <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse11" />
            <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse13" />
            <ub:undergraduateDegreeFrom>
            <ub:University rdf:about="http://www.University708.edu" /> </ub:undergraduateDegreeFrom>
            <ub:advisor rdf:resource="http://www.Department0.University0.edu/AssistantProfessor3" />
            </ub:GraduateStudent>

            GraduateStudent70
            <ub:GraduateStudent rdf:about="http://www.Department0.University0.edu/GraduateStudent70">
            <ub:name>GraduateStudent70</ub:name>
            <ub:memberOf rdf:resource="http://www.Department0.University0.edu" />
            <ub:emailAddress>GraduateStudent70@Department0.University0.edu</ub:emailAddress>
            <ub:telephone>xxx-xxx-xxxx</ub:telephone>
            <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse0" />
            <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse13" />
            <ub:takesCourse rdf:resource="http://www.Department0.University0.edu/GraduateCourse19" />
            <ub:undergraduateDegreeFrom>
            <ub:University rdf:about="http://www.University5.edu" /> </ub:undergraduateDegreeFrom>
            <ub:advisor rdf:resource="http://www.Department0.University0.edu/FullProfessor1" />
            </ub:GraduateStudent>

            BTW, Today I tried the 6th query which will query all the students exist in the database.
            It can not find out GraduateStudent64 as well.

            [query6]
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
            SELECT ?X
            WHERE {
            ?X rdf:type ub:Student
            }

            Look forward to your reply.

            Regards,
            Bryan.
            • 3. Re: LUBM SPARQL query defect - Semantic Tech
              alwu-Oracle
              This is an update for other readers. We are working with Bryan offline to make sure queries return all expected answers. We have done that many times ourselves so there should not be any problems.

              Once the problem is resolved, we will post a summary here. Thanks.
              • 4. Re: LUBM SPARQL query defect - Semantic Tech
                alwu-Oracle
                Here is a recap.
                ---------------------

                Bryan and us have worked together and resolved the query problem. Basically, OWLPrime in 11gR1 itself does
                not support all the semantics required by univ-bench.owl. To get all answers to LUBM benchmark queries,
                one can use Jena Adaptor and Pellet to do a class subsumption inference on the TBox (univ-bench.owl)
                and save the inferred class tree into a new RDF/OWL model. OWLPrime inference
                can then be applied on the new RDF/OWL model together with all the instance data.

                The steps are
                1) load univ-bench.owl into an RDF/OWL model 'univ'
                2) load Abox data into a separate RDF/OWL model 'lubm'
                3) use testEnrichTBox function or something similar to enrich this 'univ' model and store the
                enriched version into a new RDF/OWL model 'univcomp'
                4) run OWLPrime inference on two models 'lubm' and 'univcomp'
                5) run SEM_MATCH queries using sem_models('lubm','univcomp') and sem_rulebases('owlprime')

                NOTE:
                - Jena 2.5.6 version is required
                - Pellet 1.5.0 version is required
                - One can find testEnrichTBox function in
                http://www.oracle.com/technology/tech/semantic_technologies/sample_code/files/jenadrv_ex.java

                Looking forward, we are planning to support more semantics so that for LUBM onotlogies,
                step 3) is no longer necessary.
                1 person found this helpful