0

我有一个程序,通过 Eclipse 在 maven 项目中开发,它提供了一个 ETL 服务,它摄取数据,使用 Jena API 生成海龟格式 RDF,并将其加载到需要使用 Sesame API 发送给它的数据的三重存储中。因此,我需要将 ETL 服务创建的语句从 Jena 转换为 Sesame。

我想使用 Stardog 的以下类,因为它正是我需要做的。我尝试将以下依赖项添加到我的 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:shared:jar 2.2.2

缺少工件 org.openrdf.sesame:sesame:jar:2.7.12

缺少工件 com.complexible.stardog:api:jar.2.2.2

我还在上述依赖项的打开依赖项标记上收到错误,说其中包含的依赖项也丢失了。

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

有任何想法吗?

4

1 回答 1

0

我真的不知道如何帮助您解决 Maven 依赖问题 - 这对于 Stardog 来说非常具体。如果您在这里没有得到答案,您可以尝试在他们的支持邮件列表中询问这个问题。

但是,我可以提供另一种解决方案:不使用转换器类,您只需将 Jena 对象序列化回 N-Triples 或 Turtle,然后使用 Sesame 的 Rio 解析器解析它们——这当然会创建 Sesame API 对象。

我对 Jena API 不太熟悉,但我确信有一种方法可以将模型编写为OutputStreamTurtle 格式。一旦你有了它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); 
于 2015-03-13T19:05:48.560 回答