Giter Club home page Giter Club logo

sparql-dl-api's Introduction

sparq-dl-api

A query engine for SPARQL-DL. Originally written by Derivo Systems

http://www.derivo.de/en/resources/sparql-dl-api.html

sparql-dl-api's People

Contributors

matthewhorridge avatar mzefmzzfemzeoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparql-dl-api's Issues

Missing dependencies? Can't use the API

I don't get any code error, yet when I run the project through maven I always get the following error:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: de/derivo/sparqldlapi/exceptions/QueryEngineException

Here's my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>inesc</groupId>
  <artifactId>RiskOntologies</artifactId>
  <version>0.0.1-SNAPSHOT</version>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>${jersey.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
  </dependencyManagement>

  <dependencies>
  <dependency>
    <groupId>net.sourceforge.owlapi</groupId>
    <artifactId>owlapi-api</artifactId>
    <version>4.0.2</version>
  </dependency>


   <dependency>
     <groupId>edu.stanford.protege</groupId>
     <artifactId>de-derivo-sparqldlapi</artifactId>
     <version>3.0.0</version>
     <scope>system</scope>
    <!-- I've double checked this path. It is correct -->
     <systemPath>/home/lpec/lib/sparqldl-api.jar</systemPath>
  </dependency>

  <dependency>
      <groupId>edu.stanford.protege</groupId>
      <artifactId>jpaul</artifactId>
      <version>2.5.1</version>
  </dependency>

   <dependency>
      <groupId>org.jdom</groupId>
      <artifactId>jdom-legacy</artifactId>
      <version>1.1.3</version>
  </dependency>

  <dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>poi</artifactId>
      <version>3.13</version>
    </dependency>

  <dependency>
    <groupId>org.glassfish.jersey.test-framework.providers</groupId>
    <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
  </dependency>


  <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
  </dependency>


  <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-moxy</artifactId>
  </dependency>

  <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      </dependency>

     <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.6.2</version>
    </dependency>

  <dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20141113</version>
  </dependency>

  <dependency>
      <groupId>org.glassfish.jersey.containers</groupId>
      <artifactId>jersey-container-grizzly2-http</artifactId>
    </dependency>

  <dependency>
    <groupId>net.sourceforge.owlapi</groupId>
    <artifactId>owlapi-apibinding</artifactId>
    <version>4.0.2</version>
  </dependency>

  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
  </dependency>

  <dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-multipart</artifactId>
  </dependency>


</dependencies>

  <build>
    <plugins>
      <plugin>
        <!-- Build an executable JAR -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <classpathPrefix>lib/</classpathPrefix>
              <mainClass>app.App</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
       <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>exec-maven-plugin</artifactId>
           <version>1.2.1</version>
         </plugin>
    </plugins>
  </build>
  <properties>
    <jersey.version>2.22</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

In eclipse I don't see any error when I use the SPARQL-DL classes, but I can't compile the code through the command line with maven, but I can run it through Eclipse. What do I have to do to run it through command line?

Here's the complete error:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: de/derivo/sparqldlapi/exceptions/QueryEngineException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.glassfish.jersey.server.model.IntrospectionModeller$2.run(IntrospectionModeller.java:253)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.glassfish.jersey.server.model.IntrospectionModeller.getAllDeclaredMethods(IntrospectionModeller.java:247)
    at org.glassfish.jersey.server.model.IntrospectionModeller.checkForNonPublicMethodIssues(IntrospectionModeller.java:172)
    at org.glassfish.jersey.server.model.IntrospectionModeller.doCreateResourceBuilder(IntrospectionModeller.java:119)
    at org.glassfish.jersey.server.model.IntrospectionModeller.access$000(IntrospectionModeller.java:80)
    at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:112)
    at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:109)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
    at org.glassfish.jersey.server.model.IntrospectionModeller.createResourceBuilder(IntrospectionModeller.java:109)
    at org.glassfish.jersey.server.model.Resource.from(Resource.java:797)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:465)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
    at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
    at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:311)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:337)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:119)
    at app.RiskOntologiesApp.startHttpServer(RiskOntologiesApp.java:73)
    at app.RiskOntologiesApp.main(RiskOntologiesApp.java:95)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: de.derivo.sparqldlapi.exceptions.QueryEngineException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

SPARQL-DL API doesn't support datatypes (strings)

I'm using SPARQL-DL with OWL-API in a Java application. The Maven dependency is the following:

<dependency>
    <groupId>edu.stanford.protege</groupId>
    <artifactId>de-derivo-sparqldlapi</artifactId>
    <version>2.0.0</version>
</dependency>

I assume it downloads the right (compatible) version of OWL-API. I have a class Person with some individuals. Each individual has a data property called name which ranges over a string. The ontology is the following:

<?xml version="1.0"?>

<!DOCTYPE Ontology [
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
    <!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>

<Ontology xmlns="http://www.w3.org/2002/07/owl#"
     xml:base="http://www.semanticweb.org/andrea/ontologies/2016/10/untitled-ontology-83"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     ontologyIRI="http://www.semanticweb.org/andrea/ontologies/2016/10/untitled-ontology-83">
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Declaration>
        <Class IRI="#Person"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#name"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#t"/>
    </Declaration>
    <ClassAssertion>
        <Class IRI="#Person"/>
        <NamedIndividual IRI="#t"/>
    </ClassAssertion>
    <DataPropertyAssertion>
        <DataProperty IRI="#name"/>
        <NamedIndividual IRI="#t"/>
        <Literal datatypeIRI="&xsd;string">Andrea</Literal>
    </DataPropertyAssertion>
    <DataPropertyRange>
        <DataProperty IRI="#name"/>
        <Datatype abbreviatedIRI="xsd:string"/>
    </DataPropertyRange>
</Ontology>

By running this query:
SELECT ?x WHERE { PropertyValue(?y, my:name, ?x) }
I get this:
?de.derivo.sparqldlapi.Var@78 = ?"Andrea"^^xsd:string

I'm not able to get the individual, called t, having name equal to Andrea.
SELECT ?p WHERE { PropertyValue(?p, my:name, "Andrea") }
returns an empty set
and
SELECT ?p WHERE { PropertyValue(?p, my:name, "Andrea^^xsd:string") }
returns an empty set.

SELECT ?y WHERE { PropertyValue(?y, my:name, "Pluto"^^xsd:string) }
returns this error:
Character ")" awaited in SPARQL-DL query. (near "^^xsd:string", pos: 344, col: 52, row: 6)

How can I retrieve ontology individuals having a datatype property equal to a specific string value by using SPARQL-DL?

Execute with partially defined variables

Sometimes some variables are already resolved and there are no reasons to create another Query.

It is needed something like:

  • QueryEngine::execute(Query, Map<String, OWLNamedObject>)
  • QueryEngine::execute(Query, Map<String, OWLObject>)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.