forked from miquelrojascherto/bioclipse.rdf
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added method sparqlConstructRemote allowing CONSTRUCT queries returni…
…ng RDF/XML
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,13 @@ | |
******************************************************************************/ | ||
package net.bioclipse.rdf.business; | ||
|
||
import java.io.BufferedOutputStream; | ||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.io.StringWriter; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
import java.util.ArrayList; | ||
|
@@ -382,6 +385,30 @@ public StringMatrix sparqlRemote( | |
return table; | ||
} | ||
|
||
public String sparqlConstructRemote( | ||
String serviceURL, | ||
String sparqlQueryString, IProgressMonitor monitor) { | ||
if (monitor == null) | ||
monitor = new NullProgressMonitor(); | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
samuell
Author
Owner
|
||
monitor.beginTask("Sparqling the remote service..", 100); | ||
Query query = QueryFactory.create(sparqlQueryString); | ||
QueryExecution qexec = QueryExecutionFactory.sparqlService(serviceURL, query); | ||
monitor.worked(80); | ||
|
||
String rdfxml = ""; | ||
try { | ||
Model results = qexec.execConstruct(); | ||
StringWriter sw = new StringWriter(); | ||
results.write(sw, "RDF/XML"); | ||
rdfxml = sw.toString(); | ||
} finally { | ||
qexec.close(); | ||
} | ||
monitor.worked(20); | ||
return rdfxml; | ||
} | ||
|
||
public IRDFStore importRDFa(IRDFStore store, String url, | ||
IProgressMonitor monitor) | ||
throws IOException, BioclipseException, CoreException { | ||
|
Should we do a simple test to see of 'construct' is part of the input SPARQL?