【问题标题】:Maven artifact issue with stardog and sesame dependenciesStardog 和 sesame 依赖项的 Maven 工件问题
【发布时间】:2015-03-13 17:04:38
【问题描述】:

我有一个程序,通过 Eclipse 在 maven 项目中开发,它提供了一个 ETL 服务,该服务摄取数据,使用 Jena API 生成海龟格式 RDF,并将其加载到需要使用 Sesame 发送数据的三重存储中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

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

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

有什么想法吗?

【问题讨论】:

    标签: maven rdf jena sesame stardog


    【解决方案1】:

    我真的不知道如何帮助您解决 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); 
    

    【讨论】:

    • 那行得通。作为其他尝试这样做的人的说明,您需要使用您计划解析的相同格式来实例化您的 RDFWriter。对于上面的示例,您需要将其实例化为 TURTLE。
    猜你喜欢
    • 1970-01-01
    • 2011-07-18
    • 2019-02-06
    • 2012-12-15
    • 2020-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多