Search code examples
mavenrdfjenasesamestardog

Maven artifact issue with stardog and sesame dependencies


I have a program, developed in a maven project through Eclipse, that provides an ETL service which ingests data, generates turtle format RDF using the Jena API, and loads it into a triple store which requires data sent to it using the Sesame API. As such, I need to convert the statements created by the ETL service from Jena to Sesame.

I want to use the following class from Stardog, as it does precisely what I need to do. I tried to add the following dependencies to my pom.xml to resolve the issue:

    <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>

but I get the following errors:

Missing artifact com.complexible.stardog:shared:jar 2.2.2

Missing artifact org.openrdf.sesame:sesame:jar:2.7.12

Missing artifact com.complexible.stardog:api:jar.2.2.2

I also get errors on the opening Dependency tag for the above dependencies saying that the dependency contained within it is also missing.

Note: stardog.version = 2.2.2 and sesame.version = 2.7.12.

Any ideas?


Solution

  • I don't really know how to help you with the maven dependency problem - this looks very specific to Stardog. If you don't get an answer here you might try asking about this on their support mailinglist instead.

    However, I can offer an alternative solution: instead of using a convertor class, you just serialize the Jena objects back to N-Triples or Turtle, and then parse them using Sesame's Rio parser - which will of course create Sesame API objects.

    I'm not too familiar with the Jena API but I'm sure there is a way you can write a model to, say, an OutputStream in Turtle format. Once you have that OutputStream, you can simply do something like this:

    // 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);