Hello,

I have trouble trying to stack a CustomGraphQueryInferencer on a OWLIMSail. Here is a minimal (non-)working example:

        try {
        // stack owlim sail config, and set parameters
        OWLIMSailConfig owlimConfig = new OWLIMSailConfig();
        Map<URI, String> owlimConfigParams = new HashMap<>();
        owlimConfigParams.put(OWLIMSailSchema.repository_type, "in-memory-repository");
        owlimConfigParams.put(OWLIMSailSchema.entityindexsize, "200000");
        owlimConfigParams.put(OWLIMSailSchema.jobsize, "200");
        owlimConfigParams.put(OWLIMSailSchema.baseURL, "http://example.org#");
        owlimConfigParams.put(OWLIMSailSchema.newtriplesfile, "new-triples-file.nt");
        owlimConfigParams.put(OWLIMSailSchema.ruleset, "owl2-rl-conf");
        owlimConfigParams.put(OWLIMSailSchema.storagefolder, "storage");
        owlimConfigParams.put(OWLIMSailSchema.noPersist, "true");
        owlimConfig.setConfigParams(owlimConfigParams);

        // stack custom inferencer
        CustomGraphQueryInferencerConfig customSailConfig = new CustomGraphQueryInferencerConfig(owlimConfig);
        String rule = "PREFIX a: <http://a.ex#>\n"
                + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n"
                + "CONSTRUCT { ?y a:time \"2015-05-01T12:00:00Z\"^^xsd:dateTime }\n"
                + "WHERE { ?x a:hasAunt ?y }";
        String match = "PREFIX a: <http://a.ex#>\n"
                + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n"
                + "CONSTRUCT { ?y a:time \"2015-05-01T12:00:00Z\"^^xsd:dateTime }\n"
                + "WHERE { ?y a:time \"2015-05-01T12:00:00Z\"^^xsd:dateTime }";
        customSailConfig.setQueryLanguage(QueryLanguage.SPARQL);
        customSailConfig.setRuleQuery(rule);
        customSailConfig.setMatcherQuery(match);

        // create repository implementation config and repository config
        RepositoryImplConfig repImplConfig = new SailRepositoryConfig(customSailConfig);
        RepositoryConfig repConfig = new RepositoryConfig(repositoryId, repImplConfig);

        // get local repository manager and add config
        LocalRepositoryManager manager = new LocalRepositoryManager(new File("repositories"));
        manager.initialize();
        manager.addRepositoryConfig(repConfig);

        // get repository
        Repository repository = manager.getRepository(repositoryId);

    } catch (RepositoryException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } catch (RepositoryConfigException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }

I get the following exceptions:

org.openrdf.repository.RepositoryException: com.ontotext.trree.owlim_ext.SailConnectionImpl cannot be cast to org.openrdf.sail.inferencer.InferencerConnection
at org.openrdf.repository.sail.SailRepository.initializeInternal(SailRepository.java:172)
at org.openrdf.repository.base.RepositoryBase.initialize(RepositoryBase.java:38)
at org.openrdf.repository.manager.LocalRepositoryManager.createRepository(LocalRepositoryManager.java:225)
at org.openrdf.repository.manager.RepositoryManager.getRepository(RepositoryManager.java:403)
at eu.itea.seas.time.Main.main(Main.java:121)
Caused by: org.openrdf.sail.SailException: com.ontotext.trree.owlim_ext.SailConnectionImpl cannot be cast to org.openrdf.sail.inferencer.InferencerConnection
    at org.openrdf.sail.inferencer.fc.CustomGraphQueryInferencer.getConnection(CustomGraphQueryInferencer.java:192)
    at org.openrdf.sail.inferencer.fc.CustomGraphQueryInferencer.initialize(CustomGraphQueryInferencer.java:201)
    at org.openrdf.repository.sail.SailRepository.initializeInternal(SailRepository.java:163)
    ... 4 more

Caused by: java.lang.ClassCastException: com.ontotext.trree.owlim_ext.SailConnectionImpl cannot be cast to org.openrdf.sail.inferencer.InferencerConnection
    at org.openrdf.sail.inferencer.fc.CustomGraphQueryInferencer.getConnection(CustomGraphQueryInferencer.java:188)
    ... 6 more

I really need such a stack for the project I work on. Any idea of how to do that ?

Kind regards, Maxime Lefran├žois

asked 26 Jun '15, 10:44

mlefranc's gravatar image

mlefranc
1111
accept rate: 0%


You can't stack a custom inferencer on top of OWLIMSail. Can you give us some details why you need a custom one, and not use OWLIM?

Best Regards

link

answered 07 Jul '15, 07:48

Venelin%20Kotsev's gravatar image

Venelin Kotsev
4212
accept rate: 20%

Thanks for the answer. I need to call a custom fonction to infer new knowledge, and this cannot be expressed in an owlim custom rule. One of my use cases is: generate a xsd:duration literal that expresses the difference between two xsd:dateTime.

(07 Jul '15, 10:06) mlefranc
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×261

Asked: 26 Jun '15, 10:44

Seen: 1,826 times

Last updated: 07 Dec '16, 01:03

powered by BitNami OSQA