Evaluating Stardog to see if it will work in existing project, Java + Maven

Hi,
I have an existing project that I want to integrate with a NoSQL database, preferably a triplestore, but I know already that MongoDB works so I could fall back to that.
This project uses the UIMA NLP pipeline and thus has a very strict structure that I cannot change. It uses Maven to handle dependenices, with a packaging type of Java. This is not a web based project; thus all I need is to use an API to communicate with a local database.

All of the examples I see posted assume Gradle builds and are web based. The documentation for using Maven says this “If you’re using Maven as your build tool, then client-http and server dependencies require that you specify the packaging type as POM (pom):” Do I need to worry about this if I am not building a web based system? And is Gradle required? If not, are there code examples out there that just use Maven without Gradle?

Hi,

Gradle is not required; you can do the same steps via Maven, just less elegantly :slight_smile:

In your pom.xml add our public repository:

<repositories>
   <repository>
     <id>stardog-public</id>
     <url>http://maven.stardog.com</url>
   </repository>
</repositories>

Then add whichever of the artifacts you plan to use in your project:

<dependencies>
  <dependency>
    <groupId>com.complexible.stardog</groupId>
    <artifactId>client-http</artifactId>
    <version>5.0.1</version>
    <type>pom</type>
  </dependency>
  <dependency>
    <groupId>com.complexible.stardog.sesame</groupId>
    <artifactId>stardog-sesame-core</artifactId>
    <version>$VERSION</version>
  </dependency>
</dependencies>

I’m not sure what you mean by “web based system.” How are you intending to use Stardog?

Thanks. I tried setting up a very simple project, without all the UIMA overhead. The only issue now is that stardog-sesame-core seems to be missing - at least I get the message
"missing artifact com.complexible.stardog.sesame-core:jar$VERSION"
in my pom file.

Here is the pom.xml - again, this is for a very barebones test project

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  
  <repositories>
   <repository>
     <id>stardog-public</id>
     <url>http://maven.stardog.com</url>
   </repository>
</repositories>

  <dependencies>
    <dependency>
    <groupId>com.complexible.stardog</groupId>
    <artifactId>client-http</artifactId>
    <version>5.0.1</version>
    <type>pom</type>
  </dependency>
  <dependency>
    <groupId>com.complexible.stardog.sesame</groupId>
    <artifactId>stardog-sesame-core</artifactId>
    <version>$VERSION</version>
  </dependency>
  </dependencies>
</project>

Hi,

I was including those dependencies as examples. If you don’t need sesame support, there’s no need to include stardog-sesame-core. If you do need it, however, you’ll have to replace $VERSION with the version you want, which is likely 5.0.1.

If you’ll be running a Stardog server with this application, you’ll want the server dependency, perhaps on top of the client dependency. It really depends on what you’re trying to do with Stardog

OK, I do want sesame. I did try 5.0.beta, which was the only example I could find, but that didn’t work. So 5.0.1 is the correct version? Where can I find this information?

I already have integration with MongoDB, and I want this to work in the same way. For that setup, I have a MongoDB server running locally, and I use the Mongo Java API to issue queries and so on to the server. Your Sesame API looks pretty similar to the MongoDB API (actually I have used Sesame before but some years ago on another project). So I want to do the exact same thing: run a local Stardog server, and connect to it and run queries from Java. So what are my dependencies? I guess I don’t understand the distinction between client and server here. For Mongo integration, my only dependency is the driver jar. I assumed I was looking for somethng like that.

You can always check to see what the latest released version of Stardog is by checking http://www.stardog.com/. It's also listed in the documentation at http://docs.stardog.com

For your use case you'd only need the client. You would only need the server if you were going to embed Stardog into your application rather than running it separately. You can connect to Stardog using Jena, Sesame, or Stardog's native API, SNARL. Home | Stardog Documentation Latest. There are also examples located at the examples github repo

OK, thanks. That makes it clearer. I had thought to use Sesame simply because I have used it before. What is the advantage of SNARL?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.