Search code examples
sesametriplestore

How to store RDF data direct to sesame using D2R?


I am looking for any solution, to store my RDFized data direct to sesame through Java program. I have a database of 1.7 M records, i used D2R to transform it into RDF. Now i want to store RDFized data into sesame triple store. I did not generate RDF dump because data was huge. Is there any way code/solution through which i can shift my RDFized data into my triple store. Thanks


Solution

  • I believe what you're really trying to say is: you have a large RDBMS over which you've created an RDF wrapper view using D2RQ. Now you want to extract that data using SNORQL (D2RQ's SPARQL endpoint) and push it to a native RDF triple store using Sesame.

    I tried to edit your question to reflect that but unfortunately it got voted down.

    Anyway, in Sesame, you can do this through Java code by:

    1. firing a Graph Query that will return you a GraphQueryResult

      GraphQueryResult graphResult = con.prepareGraphQuery(
      QueryLanguage.SPARQL, "CONSTRUCT <...your SPARQL QUERY here ...>".evaluate();
      
    2. use the QueryResults utility class to return the Statements as a Model:

      Model resultModel = QueryResults.asModel(graphQueryResult);
      
    3. use one of the overloaded RepositoryConnection.add methods to add this data to a native Sesame store.