2017-02-13 3 views
0

Bitte helfen Sie mir laden:kann nicht mit dieser OWL Datei mit OWL API

Haben Maven verwendet und versucht Ontology Datei mit OWL API Laden .. Fehler bekommen, während die Datei ausgeführt wird:

erste Fehler :

Keine Implementierung für java.util.Set war gebunden. während java.util.Set Parameter für 0 bei uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.setOntologyStorers (OWLOntologyManagerImpl.java:1279) bei uk.ac.manchester.cs.owl.owlapi lokalisieren. OWLOntologyManagerImpl.setOntologyStorers (OWLOntologyManagerImpl.java:1279) bei uk.ac.manchester.cs.owl.owlapi.OWLAPIImplModule.configure (Unbekannt Quelle)

2. Fehler:

Ein Ausnahme wurde gefangen und Repo rted. Nachricht: org.semanticweb.owlapi.manchestersyntax.parser.ManchesterOWLSyntaxOntologyParserFactory können nicht org.semanticweb.owlapi.OWLAPIServiceLoaderModule.configure (Unbekannt Quelle)

Mein Code aussieht javax.inject.Provider gegossen werden wie:

File selectedFile = new File("E:\\Pallavi\\Ontology\\Food.owl"); 
      OWLOntologyManager m = OWLManager.createOWLOntologyManager(); 
      IRI inputDocumentIRI = IRI.create(selectedFile); 

      /* Load an ontology from a document IRI */ 
      OWLOntology ontology = m.loadOntologyFromOntologyDocument(inputDocumentIRI); 
      /* Report information about the ontology */ 
      System.out.println("Ontology Loaded..."); 
      System.out.println("Document IRI: " + inputDocumentIRI); 
      System.out.println("Logical IRI : " + ontology.getOntologyID()); 
      System.out.println("Format  : " + m.getOntologyFormat(ontology)); 
      m.removeOntology(ontology); 
      System.out.println("Done"); 

My pom.xml looks like: 

<?xml version="1.0" encoding="UTF-8"?> 
<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>com.mycompany</groupId> 
    <artifactId>TestOWL</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>jar</packaging> 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.felix</groupId> 
     <artifactId>maven-bundle-plugin</artifactId> 
     <version>2.5.3</version> 
     <extensions>true</extensions> 
     <configuration> 
      <instructions> 
      <Implementation-Title>${project.name}</Implementation-Title> 
      <Implementation-Vendor>${project.organization.name}</Implementation-Vendor> 
      <Implementation-Version>${project.version}.${maven.build.timestamp}</Implementation-Version> 
      <Bundle-SymbolicName>org.semanticweb.owl.owlapi</Bundle-SymbolicName> 
      <Bundle-Version>${project.version}</Bundle-Version> 
      <excludeDependencies>groupId=com.google.guava;scope=compile|runtime|provided, 
          groupId=com.google.inject*;scope=compile|runtime|provided, 
          groupId=org.slf4j*;scope=compile|runtime|provided</excludeDependencies> 
      </instructions> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-shade-plugin</artifactId> 
     <version>2.3</version> 
     <executions> 
      <execution> 
      <phase>package</phase> 
      <configuration> 
       <artifactSet> 
       <excludes> 
        <exclude>org.apache.felix:org.osgi.core</exclude> 
        <exclude>org.openrdf.sesame:*</exclude> 
        <exclude>com.fasterxml.jackson.core:*</exclude> 
        <exclude>com.github.jsonld-java:*</exclude> 
        <exclude>com.fasterxml.jackson.core:*</exclude> 
        <exclude>org.apache.httpcomponents:*</exclude> 
        <exclude>commons-codec:commons-codec:*</exclude> 
        <exclude>org.slf4j:*</exclude> 
        <exclude>org.semarglproject:*</exclude> 
        <exclude>com.google.guava:*</exclude> 
        <exclude>com.google.inject:*</exclude> 
        <exclude>javax.inject:*</exclude> 
        <exclude>aopalliance:*</exclude> 
        <exclude>com.google.inject.extensions:*</exclude> 
        <exclude>com.google.code.findbugs:*</exclude> 
        <exclude>org.slf4j:slf4j-api</exclude> 
        <exclude>commons-io:*</exclude> 
        <exclude>org.tukaani:*</exclude> 
        <exclude>net.sf.trove4j:*</exclude> 
       </excludes> 
       </artifactSet> 
       <transformers> 
       <transformer/> 
       </transformers> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
      <groupId>com.github.ansell.owlapi</groupId> 
      <artifactId>owlapi-api</artifactId> 
      <version>3.4.6.2-ansell</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sourceforge.owlapi</groupId> 
      <artifactId>owlapi-apibinding</artifactId> 
      <version>5.0.5</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sourceforge.owlapi</groupId> 
      <artifactId>owlapi-osgidistribution</artifactId> 
      <version>5.0.5</version> 
     </dependency> 
    </dependencies> 
    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <maven.compiler.source>1.8</maven.compiler.source> 
     <maven.compiler.target>1.8</maven.compiler.target> 
    </properties> 
</project> 

Bitte helfen Sie mir dieser Fehler loszuwerden

Antwort

0

Sie sind mit Ausnahme von n Abhängigkeiten für owlapi, die alle Fehler in Bezug auf die Injektion erklären.

Darüber hinaus verwenden Sie owlapi 5 und die Ansell-Gabel von owlapi 3. Dies wird in vielen Bereichen zu Konflikten führen.

Wenn Sie OSGi nicht verwenden (scheint nein), löschen Sie alle Abhängigkeiten außer owlapi-apibinding für 5.0.5 und entfernen Sie alle Ausnahmen. Wenn das das Problem nicht löst, aktualisieren Sie die Frage mit dem neuen Stand der Dinge.