[Neo] Importing RDF from XML file

Mattias Persson mattias at neotechnology.com
Tue Mar 10 21:11:09 CET 2009


Hi Chris,

I'm not an expert on such libraries, but the one I do know of which
has worked for me is OpenRdf parser/importers (RIO)

And I assume you're using the neo-rdf-sail component on top of neo as
your data source, am I right?

F.ex, to set up a Sail with neo4j as backing store:

    final NeoService neo = new EmbeddedNeo( "path/to/neo" );
    final IndexService index = new LuceneIndexService( neo );
    RdfStore rdfStore = new VerboseQuadStore( neo, index );
    Sail sail = new NeoSail( neo, rdfStore );
    sail.initialize();
    Runtime.getRuntime().addShutdownHook( new Thread()
    {
        public void run()
        {
            sail.shutDown();
            index.shutdown();
            neo.shutdown();
        }
    } );

Then use RIO to import the data:

    Repository repo = new SailRepository( sail );
    RepositoryConnection connection = repo.getConnection();
    connection.add(
        new URL( "http://dbpedia.org/data/The_Lord_of_the_Rings" ), "",
        RDFFormat.RDFXML );
    connection.commit();
    connection.close();

I just ran a quick test and it worked fine for me. If you're using
maven you can have these dependencies:

    groupId: org.neo4j
    artifactId: neo-rdf-sail
    version: 0.3-SNAPSHOT

    groupId: org.openrdf.sesame
    artifactId: sesame-rio-rdfxml
    version: 2.1.1

    groupId: org.openrdf.sesame
    artifactId: sesame-repository-sail
    version: 2.1.1


Hopefully it will work fine for you too! Don't hesitate to come back
with more questions.

Best,
Mattias

2009/3/10 Chris Laux <ctlaux at googlemail.com>:
> Hi all,
>
> how can I most easily import RDF/XML files (e.g.
> http://dbpedia.org/data/The_Lord_of_the_Rings) into Neo? Being new to
> Neo4j I might have missed this info somewhere on the Wiki or Mailing
> list archives, so sorry for that. I would be grateful for any hints,
> even if they involve 3rd party software.
>
> Thanks,
> Chris
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [mattias at neotechnology.com]
Neo Technology, www.neotechnology.com


More information about the User mailing list