4 Replies Latest reply on Jan 23, 2009 3:49 PM by 679108

    Union and owl:Nothing

    679108
      Hi,

      two questions:

      a) Does SEM_MATCH support UNIONS ? I only found OPTIONAL support with version 11.1.07.

      I want to realize a logical or within a SPARQL-Query. One attribute should be filled with values from different properties.

      SELECT name
      FROM TABLE(SEM_MATCH('
      ...
      (:instance rdfs:label ?name) UNION (:instance uri:synonym ?name)
      ...
      )',...

      b) Does SEM_MATCH know about owl:Nothing?

      owl:Thing can be found, but a query for owl:Nothing returns with 0 rows...



      Thanks in advance...
        • 1. Re: Union and owl:Nothing
          alwu-Oracle
          We don't support unions inside SEM_MATCH. However, it is easy to write union outside.

          select name from table(sem_match(...)....)
          union -- or union all
          select name from table(sem_match(...)....)

          What query results are you expecting to see that are relevant to owl:Nothing?
          • 2. Re: Union and owl:Nothing
            679108
            Thank you for your answer!

            Union:
            Okay, this is quite complex to do in my case, as I construct the SPARQL-Query dynamically due to specific circumstances. An integrated union would furthermore be more efficient, because it affects only two properties instead of all... (an external union leads to two times nearly the same query). But it seems as if there is no alternative...

            owl:Nothing:
            I try to get the most specialised class in a hierarchy (i.e. the most specialised type of an instance). The only way I found is to search for a class, which has owl:Nothing as direct subclass. But another problem is to get a 'direct' subclass. The property <urn:x-hp-direct-predicate:http_//www.w3.org/2000/01/rdf-schema#subClassOf> seems not to be supported... (in Pellet it works perfect)
            Another way (without using owl:Nothing) would be to search for the direct type of an instance, but i haven't found a way to realize this, as the inferencing leads to the behaviour, that all 'higher' classes are the type of a specific instance.

            example:

            Class1
              |- Class2
                  |- Class3
                      |- instance
                      |- owl:Nothing

            I want to get Class 3, but because of the inferencing, i also get Class1 and 2.
            • 3. Re: Union and owl:Nothing
              alwu-Oracle
              Let's see whether this example addresses your question.


              truncate table t_tpl;

              insert into t_tpl (triple) values(sdo_rdf_triple_s('tst', '<urn:X>',
              '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<urn:C1>'));
              insert into t_tpl (triple) values(sdo_rdf_triple_s('tst', '<urn:C1>',
              '<http://www.w3.org/2000/01/rdf-schema#subClassOf>', '<urn:C2>'));
              insert into t_tpl (triple) values(sdo_rdf_triple_s('tst', '<urn:C2>',
              '<http://www.w3.org/2000/01/rdf-schema#subClassOf>', '<urn:C3>'));
              insert into t_tpl (triple) values(sdo_rdf_triple_s('tst', '<urn:C3>',
              '<http://www.w3.org/2000/01/rdf-schema#subClassOf>', '<urn:C4>'));

              exec sem_apis.create_entailment('t_idx',sem_models('tst'), sem_rulebases('owlprime'));

              select c from table(sem_match('(<urn:X> rdf:type ?c)', sem_models('tst'),
              sem_rulebases('owlprime'), null, null, null, null));
              ==> C1, C2, C3, C4


              -- Now, we can exclude those super classes by using a SQL 'minus'

              select c from table(sem_match('(<urn:X> rdf:type ?c)', sem_models('tst'),
              sem_rulebases('owlprime'), null, null, null, null))
              minus
              select c from table(sem_match('(<urn:X> rdf:type ?c)(?sub rdfs:subClassOf ?c)',sem_models('tst'),
              sem_rulebases('owlprime'), null, null, null, null))
              ;
              ==> C1 only


              Note that if it is possible for (?x subClassOf ?x) to happen, then you can add an additional predicate (where c <> sub)
              to the second select statment.

              Note also that my hierachy is the reverse of yours.

              Cheers,
              Zhe Wu
              1 person found this helpful
              • 4. Re: Union and owl:Nothing
                679108
                Hi,

                thank you very much. That sounds interesting. Next week I will give it a try.