transform my rdf file to a named graph file


For a project I have to use Apache Jena as an API and Blazegraph as a triple store, I am trying to program a code that allows me to transform my dataset (N-Triples File) to a file that contains the NamedGraph of each statement.

String APIUrl = "http://localhost:9999/bigdata/namespace/drugbank/sparql"; String req = "select * WHERE {?x ?y ?z}"; RDFConnection conn = RDFConnectionFactory.connect(APIUrl); FileManager.get().addLocatorClassLoader(Main.class.getClassLoader()); Model model = FileManager.get().loadModel("drugbank.nt",null,"NTRIPLES"); conn.load(model); Query query = QueryFactory.create(req); QueryExecution qexec = QueryExecutionFactory.create(query,model); try { ResultSet rs = qexec.execSelect(); Model m1 = RDFOutput.encodeAsModel(rs); StmtIterator iter = m1.listStatements(); int i=0; final Model mStat = ModelFactory.createDefaultModel(); while (iter.hasNext()) { i++; Statement stmt = iter.nextStatement() ; // code for named Graph } }catch(Exception){ }


You can load the model directly to a remote named graph:

conn.load(model); loads the default graph.

conn.load(graphName, model); loads a named graph.


  • php in javascript is it possible
  • HBase with Kerberos - keep a HTable instance open more than 10 hours
  • SPARQL - Find objects with the most similar properties
  • Are typed literals “tricky” in RDF4J?
  • Execute Success but num_rows return 0 [PHP-MySQL]
  • How to export MS Access table into a csv file in Python using e.g. pypyodbc
  • Problems using HOGDescriptor
  • OPENCV : CUDA context initialization for different methods
  • Finding references in Visual Studio
  • How to port C# Console application to Windows Phone
  • c++ create an array with string::size
  • How should I add a stationary progress bar to a C++ program that produces terminal output (in Linux)
  • Kubernetes 1.7 on Google Cloud: FailedSync Error syncing pod, SandboxChanged Pod sandbox changed, it
  • JAXB Root Class Rename using binding.xml
  • TCL throws invalid command name when writing csv data to a matrix within a namespace
  • Displaying Data From Multiple MySQL Tables
  • Memory usage and time for execution for another process using C#?
  • Raise Session_OnStart event from custom ASP.NET SessionStateProvider class
  • How to load a CascadeClassifier using Emgu c#
  • Global session variable in express.js route?
  • Need help to stop program terminating without users consent
  • PHP Handling Namespace with SimpleXML
  • Finding All Combinations (cartesian product) of list values in vb.net
  • parsing xml and html page with lxml and requests package in python
  • Writing to Ontotext GraphDB using Jena
  • How to add System.Windows dll to Visual Studio 2010 express?
  • C++ Coin flip program error
  • string.IsNullOrEmpty() Doesn't Seem to Work on a String within a Class within a Class
  • Express JS Display Data By ID
  • CORS with socket.io
  • Converting query results into DataFrame in python
  • mave 3.2 not able to access local nexus instance return 502 code
  • WPF Template Binding in ToggleButton UserControl
  • Tomcat memory Leak
  • Cannot resolve symbol 'MyApi'
  • ORA-29908: missing primary invocation for ancillary operator
  • How to get next/previous record number?
  • How do you join a server to an Active Directory (domain)?
  • How does Linux kernel interrupt the application?
  • Checking variable from a different class in C#