与stardog和芝麻依赖关系的Maven工件问题

时间:2015-03-13 17:04:38

标签: maven rdf jena sesame stardog

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

我想使用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:shared:jar 2.2.2

缺少神器org.openrdf.sesame:sesame:jar:2.7.12

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

我也在上面依赖项的开放Dependency标记上遇到错误,说明其中包含的依赖项也缺失了。

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

有什么想法吗?

1 个答案:

答案 0 :(得分: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);