2015-03-13 51 views
0

我已經使用了耶拿API的程序,通過Eclipse的Maven項目,提供其攝取數據的ETL服務,開發產生龜格式RDF,並將其加載到三店這需要使用Sesame API發送給它的數據。因此,我需要將由耶拿ETL服務創建的語句轉換爲芝麻。與stardog和芝麻依賴Maven構件的問題

我想用從Stardog的following class,因爲它正是我需要做的。我想下面的依賴關係添加到我的pom.xml來解決問題:

<dependency> 
     <groupId>com.complexible.stardog.protocols.http</groupId> 
     <artifactId>client</artifactId> 
     <version>${stardog.version}</version> 
     <exclusions> 
      <exclusion> 
       <!-- Depends on this as if it were a jar artifact, when it is a pom --> 
       <artifactId>sesame</artifactId> 
       <groupId>org.openrdf.sesame</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>com.complexible.stardog.reasoning.http</groupId> 
     <artifactId>client</artifactId> 
     <version>${stardog.version}</version> 
     <exclusions> 
      <exclusion> 
       <!-- Depends on this as if it were a jar artifact, when it is a pom --> 
       <artifactId>sesame</artifactId> 
       <groupId>org.openrdf.sesame</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>com.complexible.stardog</groupId> 
     <artifactId>core</artifactId> 
     <version>${stardog.version}</version> 
     <exclusions> 
      <exclusion> 
       <!-- Depends on this as if it were a jar artifact, when it is a pom --> 
       <artifactId>sesame</artifactId> 
       <groupId>org.openrdf.sesame</groupId> 
      </exclusion> 
      <exclusion> 
       <artifactId>license</artifactId> 
       <groupId>com.clarkparsia</groupId> 
      </exclusion> 
      <exclusion> 
       <artifactId>erg</artifactId> 
       <groupId>com.complexible.erg</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 

,但我得到了以下錯誤:

缺少神器com.complexible.stardog:共享:罐子2.2.2

缺少神器org.openrdf.sesame:芝麻中:jar:2.7.12

缺少神器com.complexible.stardog:API:jar.2.2.2

我也得到錯誤上述依賴關係的開放依賴項標籤說明它所包含的依賴關係也缺失。

注:stardog.version = 2.2.2和sesame.version = 2.7.12。

任何想法?

回答

0

我真的不知道如何幫助你解決maven依賴問題 - 這看起來非常特定於Stardog。如果你在這裏沒有得到答案,你可以嘗試在他們的支持郵件列表上詢問這個問題。但是,我可以提供一種替代解決方案:不是使用轉換器類,而是將Jena對象序列化回N-Triples或Turtle,然後使用Sesame的Rio解析器解析它們 - 這當然會創建Sesame API對象。

我對Jena API不太熟悉,但我確信有一種方法可以將模型寫入Turtle格式的OutputStream。一旦你有這個OutputStream,你可以簡單地做這樣的事情:

// in case of very large files, use something more efficient, like a 
// PipedOutputStream, or first write back to disk 
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); 

// parse the data using Sesame Rio, which provides a Sesame Model  
// object. You can of course also immediately write the 
// data to the store instead of first creating a Model. 
org.openrdf.model.Model model = Rio.parse(in, "", RDFFormat.TURTLE); 
+0

這工作。至於其他人,試圖做到這一點的說明,你需要與你打算用解析相同的格式來實例RDFWriter。對於上面的示例,您需要將其實例化爲TURTLE。 – DivDiff 2015-03-18 18:40:10