2 Replies Latest reply: Sep 8, 2012 3:14 AM by scatmull RSS

    Unexpected Results - Single Triple Returns 2 Results Using SEM_MATCH

    scatmull
      Hi, I have a prototype I am building. I'm starting with a very simple single triple store that says
      (<http://ihc.com/drik/concept#clinical_cohort>, <http://www.w3.org/2000/01/rdf-schema#subClassOf>, <http://ihc.com/drik/concept#cohort>)
      I execute the following expecting to get back just one result (URI for cohort) but I get back 3 results:
      select
        object
      from 
        table(sem_match('{ <http://ihc.com/drik/concept#clinical_cohort> <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?object . }', 
              sem_models('Prototype'),
              sem_rulebases('RDFS'),
              sem_aliases(sem_alias('rdfs','http://www.w3.org/2000/01/rdf-schema/')),
              null
              ))
      http://ihc.com/drik/concept#cohort
      http://ihc.com/drik/concept#clinical_cohort
      http://www.w3.org/2000/01/rdf-schema#Resource
      Can you help me understand why I get the self-reference back? Is clinical_cohort a subclass of itself? That seems counter-intuitive to me. I understand the subclass of Resource and I'm okay with that.

      Script to reproduce is:
      CREATE TABLE DRIK.RDF_DATA
      (
        ID      NUMBER,
        TRIPLE  MDSYS.SDO_RDF_TRIPLE_S
      )
      COLUMN TRIPLE NOT SUBSTITUTABLE AT ALL LEVELS
      TABLESPACE RDF_USERS
      ;
      
      -- Staging Table
      CREATE TABLE DRIK.RDF_STAGING
      (
        RDF$STC_SUB        VARCHAR2(4000 BYTE)        NOT NULL,
        RDF$STC_PRED      VARCHAR2(4000 BYTE)        NOT NULL,
        RDF$STC_OBJ        VARCHAR2(4000 BYTE)        NOT NULL,
        RDF$STC_SUB_EXT    VARCHAR2(64 BYTE),
        RDF$STC_PRED_EXT  VARCHAR2(64 BYTE),
        RDF$STC_OBJ_EXT    VARCHAR2(64 BYTE),
        RDF$STC_CANON_EXT  VARCHAR2(64 BYTE)
      )
      TABLESPACE RDF_USERS
      ;
      
      begin  SEM_APIS.CREATE_RDF_MODEL('Prototype', 'RDF_DATA', 'TRIPLE', 'RDF_USERS'); end;
      
      grant insert on rdf_data to mdsys;
       
      Insert into DRIK.RDF_STAGING
         (RDF$STC_SUB, RDF$STC_PRED, RDF$STC_OBJ)
       Values
         ('<http://ihc.com/drik/concept#clinical_cohort>', '<http://www.w3.org/2000/01/rdf-schema#subClassOf>', '<http://ihc.com/drik/concept#cohort>');
      COMMIT;
      
      begin SEM_APIS.BULK_LOAD_FROM_STAGING_TABLE('Prototype', 'DRIK', 'RDF_STAGING'); end;
      
      select id, a.triple.GET_TRIPLE() from drik.rdf_data a;
      
      begin SEM_APIS.CREATE_ENTAILMENT('PROTOTYPE_RB_IDX', SEM_Models('Prototype'), SEM_Rulebases('RDFS')); end;