[New User] RDF4J and Blazegraph

162 views
Skip to first unread message

Hayden Freedman

unread,
Mar 28, 2017, 11:59:40 AM3/28/17
to RDF4J Users
Hello, I am new to RDF4J but am interested in implementing its API to work together with BlazeGraph. I would like to be able to add, edit, and remove RDF data from my Blazegraph database using RDF4J syntax. However I have not been able to understand much of the documentation to do this. I was wondering if anyone knows of a beginner's guide to connecting RDF4J with an external RDF triple store.  

Thanks,
-H

Oliver Ruebenacker

unread,
Mar 28, 2017, 2:10:43 PM3/28/17
to rdf4j...@googlegroups.com

     Hello,

  Check BlazeGraph docs how to create a Repository. Then check RDF4J docs on what to do with a Repository (which is call initialize() and then getConnection() to get a RepositoryConnection, which has add, remove, read and write methods)

     Best, Oliver

--
You received this message because you are subscribed to the Google Groups "RDF4J Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rdf4j-users+unsubscribe@googlegroups.com.
To post to this group, send email to rdf4j...@googlegroups.com.
Visit this group at https://groups.google.com/group/rdf4j-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/rdf4j-users/d28de38b-1c00-47a6-b49f-96bb01855098%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Oliver Ruebenacker
Senior Software Engineer, Diabetes Portal, Broad Institute

Hayden Freedman

unread,
Mar 28, 2017, 2:30:22 PM3/28/17
to RDF4J Users
Hi Oliver,
Thanks very much for your response, it is really appreciated and helpful. I have added the following to my Scala code: 

import org.eclipse.rdf4j.model._

val repo: BigdataSailRepository = new BigdataSailRepository(sail)
repo.initialize()
RDF4JTest(repo)

def RDF4JTest (repo: Repository)
  {
    val f: ValueFactory = repo.getValueFactory().asInstanceOf[ValueFactory]
    val alice: IRI = f.createIRI("http://example.org/people/alice")
    val bob: IRI = f.createIRI("http://example.org/people.bob")
    val name: IRI = f.createIRI("http://example.org/ontology/name")
    val person: IRI = f.createIRI("http://example.org/ontology/Person")
    val bobsName: Literal = f.createLiteral("Bob")
    val alicesName: Literal = f.createLiteral("Alice")
    val cxn: RepositoryConnection = repo.getConnection()
    cxn.add(alice, RDF.TYPE, person)
    cxn.add(alice, name, alicesName)
    cxn.add(bob, RDF.TYPE, person)
    cxn.add(bob, name, bobsName)
  }

When I try to compile, I get two errors:
1. not found: value RDF
2. overloaded method value add with alternatives (long list here) cannot be applied to (org.exlipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Literal)

I tried to follow the instructions exactly from the page so I am not sure what is wrong here. If you have some idea of what could be the problem I would really like to hear it!

Thank you,
-H


On Tuesday, 28 March 2017 14:10:43 UTC-4, Oliver Ruebenacker wrote:

     Hello,

  Check BlazeGraph docs how to create a Repository. Then check RDF4J docs on what to do with a Repository (which is call initialize() and then getConnection() to get a RepositoryConnection, which has add, remove, read and write methods)

     Best, Oliver
On Tue, Mar 28, 2017 at 11:59 AM, Hayden Freedman <hayden....@gmail.com> wrote:
Hello, I am new to RDF4J but am interested in implementing its API to work together with BlazeGraph. I would like to be able to add, edit, and remove RDF data from my Blazegraph database using RDF4J syntax. However I have not been able to understand much of the documentation to do this. I was wondering if anyone knows of a beginner's guide to connecting RDF4J with an external RDF triple store.  

Thanks,
-H

--
You received this message because you are subscribed to the Google Groups "RDF4J Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rdf4j-users...@googlegroups.com.

Oliver Ruebenacker

unread,
Mar 28, 2017, 2:46:08 PM3/28/17
to rdf4j...@googlegroups.com

     Hello,

  You need to import org.eclipse.rdf4j.model.vocabulary.RDF.

     Best, Oliver

To unsubscribe from this group and stop receiving emails from it, send an email to rdf4j-users+unsubscribe@googlegroups.com.

To post to this group, send email to rdf4j...@googlegroups.com.
Visit this group at https://groups.google.com/group/rdf4j-users.

For more options, visit https://groups.google.com/d/optout.

Hayden Freedman

unread,
Mar 28, 2017, 2:59:05 PM3/28/17
to RDF4J Users
Thank you! That fixed my first problem, I now am able to use RDF.TYPE without getting an error. I thought that importing org.eclipse.rdf4J.model._ would import the entire library, but apparently not.

I still am receiving the second error I mentioned (cxn.add is not compiling with the arguments I am giving it). Do you have ideas for some techniques I might be able to use to debug this problem?

Really appreciate the help,
-H

Oliver Ruebenacker

unread,
Mar 29, 2017, 3:51:37 PM3/29/17
to rdf4j...@googlegroups.com

     Hello,

  Not sure.

  Is that a typo or does the error message really say "org.exlipse.rdf4j.model.IRI" (note the "x" in "exclipse"?)

  Not sure it helps, but maybe post the complete code?

     Best, Oliver

To unsubscribe from this group and stop receiving emails from it, send an email to rdf4j-users+unsubscribe@googlegroups.com.

To post to this group, send email to rdf4j...@googlegroups.com.
Visit this group at https://groups.google.com/group/rdf4j-users.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages