4.2 Performing Inference on SKOS RDF Graphs

Performing inference on a SKOS RDF graph is similar to performing inference on an RDF graph.

To create an SKOS RDF graph, use the same procedure (SEM_APIS.CREATE_RDF_GRAPH) as for creating an RDF graph. You can load data into an SKOS RDF graph in the same way as for RDF graphs.

To infer new relationships for one or more SKOS RDF graphs, use the SEM_APIS.CREATE_INFERRED_GRAPH procedure with the system-defined rulebase SKOSCORE. For example:

EXECUTE sem_apis.create_inferred_graph('tstidx',sem_models('tst'), sem_rulebases('skoscore')), network_owner=>'RDFUSER', network_name=>'NET1');

The inferred data will include many of the axioms defined in the SKOS detailed specification. Like other system-defined rulebases, SKOSCORE has no explicit rules; all the semantics supported are coded into the implementation.

4.2.1 Validating SKOS RDF Graphs and Inferred Graphs

You can use the SEM_APIS.VALIDATE_INFERRED_GRAPH and SEM_APIS.VALIDATE_RDF_GRAPH procedures to validate the supported integrity conditions. The output will include any inconsistencies caused by the supported integrity conditions, such as OWL 2 propertyDisjointWith and S52.

Example 4-2 validates an SKOS inferred graph.

Example 4-2 Validating an SKOS Inferred Graph

set serveroutput on
declare
  lva sem_longvarchararray;
  idx int;
begin
  lva := sem_apis.validate_inferred_graph(sem_models('tstskos'), sem_rulebases('skoscore'), network_owner=>'RDFUSER',network_name=>'NET1');
  if (lva is null) then
    dbms_output.put_line('No conflicts');
  else
  for idx in 1..lva.count loop
    dbms_output.put_line('entry ' || idx || ' ' || lva(idx));
  end loop;
  end if;
end;
 /

4.2.2 Property Chain Handling

The SKOS S55, S56, and S57 semantics are not supported by default. However, you can add support for them by using the OWL 2 subproperty chain construct.

Example 4-3 inserts the necessary chain definition triples for S55 into an SKOS model. After the insertion, an invocation of SEM_APIS.CREATE_INFERRED_GRAPH that specifies the SKOSCORE rulebase will include the semantics defined in S55.

Example 4-3 Property Chain Insertions to Implement S55

INSERT INTO tst VALUES(sdo_rdf_triple_s('tst','<http://www.w3.org/2004/02/skos/core#prefLabel>', '<http://www.w3.org/2002/07/owl#propertyChainAxiom>', '_:jA1', 'RDFUSER', 'NET1'));
INSERT INTO tst VALUES(sdo_rdf_triple_s('tst','_:jA1', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#first>', '<http://www.w3.org/2008/05/skos-xl#prefLabel>', 'RDFUSER', 'NET1'));
INSERT INTO tst VALUES(sdo_rdf_triple_s('tst','_:jA1', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>', '_:jA2', 'RDFUSER', 'NET1'));
INSERT INTO tst VALUES(sdo_rdf_triple_s('tst','_:jA2', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#first>', '<http://www.w3.org/2008/05/skos-xl#literalForm>', 'RDFUSER', 'NET1'));
INSERT INTO tst VALUES(sdo_rdf_triple_s('tst','_:jA2', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>', 'RDFUSER', 'NET1'));