2 Replies Latest reply on Aug 28, 2009 4:07 PM by 671085

    How-to use Jena Adaptor and rulebase inferencing ?

    671085
      Hello

      When using Jena adaptor, how can I specify a rulebase to use ? for example, when I see this query made by the adaptor :

      SELECT x$RDFVTYP, decode(x$RDFVTYP, 'BLN', ('_:'||substr(x,instr(x,'m',4)+1)), x) x FROM table(sdo_rdf_match('(?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.chu-rouen.fr/stms#CIM10Concept>) ', sdo_rdf_models('RDF_MODEL'), null, null, null, null))

      I would like it to use the value "SDO_RDF_Rulebases('OWLPRIME')" instead of the first 'null' at the end of the query.

      Can someone provide/point to a sample of code to do that ?

      Thanks
      Thomas Francart - MONDECA
        • 1. Re: How-to use Jena Adaptor and rulebase inferencing ?
          alwu-Oracle
          Hi,

          It is simple. You can use Attachment class. This is a quick example.

          Attachment attachment = Attachment.createInstance(
          Attachment.NO_ADDITIONAL_MODELS, "OWLPRIME",
          InferenceMaintenanceMode.NO_UPDATE,
          QueryOptions.DEFAULT);
          GraphOracleSem graph = new GraphOracleSem(oracle, modelName, attachment);
          ModelOracleSem model = new ModelOracleSem(graph);

          ... add triples (if the data is already loaded, then do nothing) ...

          graph.performInference();

          graph.analyzeInferredGraph();

          ... run SPARQL query against model ...

          I have answered some relevant questions. You can refer to
          Deselect Rules using Jena Attachment class
          OWLPrime and Jena

          Thanks,

          Zhe Wu
          • 2. Re: How-to use Jena Adaptor and rulebase inferencing ?
            671085
            Found it myself, it is actually right in te documentation :-)
            You need to specify this when creating the GraphOracleSem object :

                      // add inferencing
                      Attachment attachment = Attachment.createInstance(
                      Attachment.NO_ADDITIONAL_MODELS, "OWLPRIME",
                      InferenceMaintenanceMode.UPDATE_WHEN_COMMIT,
                      QueryOptions.DEFAULT);

                 GraphOracleSem graph = new GraphOracleSem(oracle, modelName, attachment);

            Thomas