Maven dependencies for examples??

2 views
Skip to first unread message

Brad Cox

unread,
Jun 19, 2014, 12:11:00 PM6/19/14
to sta...@clarkparsia.com
I'm unable to compile the examples in eclipse/maven. I've run mavenDependencies.sh and verified they're installed in .m2.
But eclipse is unable to find the following symbols and I haven't been able to find them in any of the jars shown in the dox. 

Could someone please advise? Thanks!.

import com.complexible.common.openrdf.OpenRdfIO;
import com.complexible.common.openrdf.Graphs;
import com.complexible.common.protocols.server.Server;
import com.complexible.stardog.Stardog;

Partial pom:

<dependencies>
                      ...   
                  <dependency>
<groupId>com.complexible.common</groupId>
<artifactId>core</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>com.complexible.common</groupId>
<artifactId>openrdf</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.complexible.stardog</groupId>
<artifactId>api</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.complexible.stardog.protocols.snarl</groupId>
<artifactId>client</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.complexible.common.protocols.api</groupId>
<artifactId>client</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.complexible.stardog.reasoning.snarl</groupId>
<artifactId>client</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.complexible.stardog.search.snarl</groupId>
<artifactId>client</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.complexible.stardog.icv.snarl</groupId>
<artifactId>client</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.googlecode.sli4j</groupId>
<artifactId>sli4j-slf4j-log4j</artifactId>
<version>2.0</version>
</dependency>
</dependencies>

Brad Cox

unread,
Jun 19, 2014, 12:49:01 PM6/19/14
to sta...@clarkparsia.com
Kendal wrote that the open source java client would be available with usable dependencies in Stardog 2.0. We're up to 2.1.3 now but I don't see usable dependencies anywhere. Is this still on track?

Mike Grove

unread,
Jun 19, 2014, 12:51:01 PM6/19/14
to stardog
On Thu, Jun 19, 2014 at 12:10 PM, Brad Cox <brad...@gmail.com> wrote:
I'm unable to compile the examples in eclipse/maven. I've run mavenDependencies.sh and verified they're installed in .m2.

mavenDependencies currently only installs the client APIs into a local maven repo.  The examples, because they're standalone, require the server jars as well.
 
But eclipse is unable to find the following symbols and I haven't been able to find them in any of the jars shown in the dox. 

Could someone please advise? Thanks!.

import com.complexible.common.openrdf.OpenRdfIO;
import com.complexible.common.openrdf.Graphs;
import com.complexible.common.protocols.server.Server;
import com.complexible.stardog.Stardog;

Partial pom:

<dependencies>
                      ...   
                  <dependency>
<groupId>com.complexible.common</groupId>
<artifactId>core</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>com.complexible.common</groupId>
<artifactId>openrdf</artifactId>
<version>2.0.2</version>
</dependency>

This dependency should have OpenRdfIO and Graphs, I'm not sure why they would not be found.

The Server & Stardog classes are in the server directory in the distribution.  If you include the jars in that directory in your classpath, you should be good to go.

There was a similar question on the mailing list [1] about this recently.

Cheers,

Mike

 

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Brad Cox

unread,
Jun 19, 2014, 1:25:41 PM6/19/14
to sta...@clarkparsia.com
Adding all jars from the 3 server directories resolved the Server and  Stardog problems but OpenRdfIO and Graphs are nowhere to be found. 

Is there a getting started example that doesn't need so many dependencies? 


Mike Grove

unread,
Jun 19, 2014, 1:35:02 PM6/19/14
to stardog
On Thu, Jun 19, 2014 at 1:25 PM, Brad Cox <brad...@gmail.com> wrote:
Adding all jars from the 3 server directories resolved the Server and  Stardog problems but OpenRdfIO and Graphs are nowhere to be found. 

I just noticed the package names on OpenRdfIO and Graphs are not correct.  OpenRdfIO is not actually used in the examples in the distribution.

What code are you running?

Cheers,

Mike
 

Is there a getting started example that doesn't need so many dependencies? 


Brad Cox

unread,
Jun 19, 2014, 1:48:47 PM6/19/14
to sta...@clarkparsia.com
Pasted from https://gist.github.com/mhgrove/1045573 which is linked from the dox.


Brad Cox

unread,
Jun 19, 2014, 1:51:43 PM6/19/14
to sta...@clarkparsia.com
I have a working server. What I really want is sample code for how to issue sparql queries to it from java. I don't really want to be running an embedded server.


 

Mike Grove

unread,
Jun 19, 2014, 1:56:09 PM6/19/14
to stardog
On Thu, Jun 19, 2014 at 1:51 PM, Brad Cox <brad...@gmail.com> wrote:
I have a working server. What I really want is sample code for how to issue sparql queries to it from java. I don't really want to be running an embedded server.

The complete source code for all the examples is in the examples directory in the distribution.

For any example, you can simply remove the code that starts the embedded server and connect to your existing server since you have one running.  If you ran it with the default settings, you can use "http://localhost:5820" as the server URL in the ConnectionConfiguration.

Cheers,

Mike

Brad Cox

unread,
Jun 19, 2014, 1:56:48 PM6/19/14
to sta...@clarkparsia.com
I got it to compile finally. From memory, I just changed Graph to GraphIO and had eclipse repair imports. 

Brad Cox

unread,
Jun 19, 2014, 2:22:06 PM6/19/14
to sta...@clarkparsia.com
Is this the "code that starts the embedded server"? What should I change exactly?

 Server aServer = Stardog
                 
.buildServer()
                 
.bind(SNARLProtocolConstants.EMBEDDED_ADDRESS)
                 
.start();

Mike Grove

unread,
Jun 19, 2014, 2:24:07 PM6/19/14
to stardog
On Thu, Jun 19, 2014 at 2:22 PM, Brad Cox <brad...@gmail.com> wrote:
Is this the "code that starts the embedded server"? What should I change exactly?

 Server aServer = Stardog
                 
.buildServer()
                 
.bind(SNARLProtocolConstants.EMBEDDED_ADDRESS)
                 
.start();



Yes, that's the code that starts the embedded server.  You said you have a server running already, so there's no need to start an embedded server.  Just provide the URL of your existing server to the ConnectionConfiguration and you're all set.

Cheers,

Mike

Brad Cox

unread,
Jun 19, 2014, 3:11:00 PM6/19/14
to sta...@clarkparsia.com
I reduced the example to just this where bcox is the dns name of the server; pasted from the server web interface.
 
public class TrySnarl
{
public static void main(String[] args) throws Exception
{
Connection aConn = ConnectionConfiguration
                .to("snarl://bcox:5820/dtraLocations")
                .credentials("admin", "admin")
                .connect();
return;
}
}

and it dies as follows. Same results with http: instead of snarl: Why would the connection be refused?

Exception in thread "main" io.netty.channel.ChannelException: connection refused
 at io
.netty.channel.local.LocalChannel$LocalUnsafe.connect(LocalChannel.java:359)
 at io
.netty.channel.DefaultChannelPipeline$HeadHandler.connect(DefaultChannelPipeline.java:1008)
 at io
.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:497)
 at io
.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:482)
 at io
.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:467)
 at io
.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:847)
 at io
.netty.channel.AbstractChannel.connect(AbstractChannel.java:199)
 at io
.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:165)
 at io
.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
 at io
.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
 at io
.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
 at java
.lang.Thread.run(Thread.java:744)
Enter code here...



 


Brad Cox

unread,
Jun 19, 2014, 7:11:35 PM6/19/14
to sta...@clarkparsia.com

As Stephen Kahmann reported here earlier, the AdminConnectionConfiguration call works, the ConnectionConfiguration call fails as I reported earlier. 

public static void main(String[] args) throws Exception
{
AdminConnection dbms = AdminConnectionConfiguration.toServer("snarl://localhost:5820").credentials("admin", "admin").connect();
// dbms.createMemory("test");
dbms.close();
Connection aConn = ConnectionConfiguration.to("snarl://localhost:5820/dtraLocations").credentials("admin", "admin").connect();
return;
}

Mike Grove

unread,
Jun 19, 2014, 8:28:18 PM6/19/14
to stardog
On Thu, Jun 19, 2014 at 3:11 PM, Brad Cox <brad...@gmail.com> wrote:
I reduced the example to just this where bcox is the dns name of the server; pasted from the server web interface.
 
public class TrySnarl
{
public static void main(String[] args) throws Exception
{
Connection aConn = ConnectionConfiguration
                .to("snarl://bcox:5820/dtraLocations")

The ConnectionConfiguration#to method [1] specifies the name of the database to connect to whereas ConnectionConfiguration#server [2] specifies the URL of your server.  If you want to specify both at the same time, ie a full connection string, you can use the static method, from [3].

Cheers,

Mike

 
                .credentials("admin", "admin")
                .connect();
return;
}
}

and it dies as follows. Same results with http: instead of snarl: Why would the connection be refused?

Exception in thread "main" io.netty.channel.ChannelException: connection refused
 at io
.netty.channel.local.LocalChannel$LocalUnsafe.connect(LocalChannel.java:359)
 at io
.netty.channel.DefaultChannelPipeline$HeadHandler.connect(DefaultChannelPipeline.java:1008)
 at io
.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:497)
 at io
.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:482)
 at io
.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:467)
 at io
.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:847)
 at io
.netty.channel.AbstractChannel.connect(AbstractChannel.java:199)
 at io
.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:165)
 at io
.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
 at io
.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
 at io
.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
 at java
.lang.Thread.run(Thread.java:744)
Enter code here...



 


Fernando Hernandez

unread,
Jun 19, 2014, 9:57:20 PM6/19/14
to sta...@clarkparsia.com
You're passing a full connection string to 'ConnectionConfiguration.to()' when you should be passing a database name [1]. You should use 'ConnectionConfiguration.from()' in order to specify the full connection string.


Cheers,
Fernando

Brad Cox

unread,
Jun 20, 2014, 5:31:55 AM6/20/14
to sta...@clarkparsia.com
Thanks. That fixed it.

Dr. Brad J. Cox    Cell: 703-594-1883 Blog: http://bradjcox.blogspot.com


On Jun 19, 2014, at 8:28 PM, Mike Grove <mi...@clarkparsia.com> wrote:
Reply all
Reply to author
Forward
0 new messages