Skip to content

Commit

Permalink
let rdf.sparqlConstructRemote return a Jena Model instead of (RDF/XML…
Browse files Browse the repository at this point in the history
…) String
  • Loading branch information
samuell committed Sep 16, 2010
1 parent 2d2ea69 commit bf7473f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
Expand Up @@ -27,6 +27,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

import com.hp.hpl.jena.rdf.model.Model;

@PublishedClass("Contains RDF related methods")
@TestClasses(
"net.bioclipse.rdf.tests.APITest," +
Expand Down Expand Up @@ -195,7 +197,7 @@ public IStringMatrix sparqlRemote(String url, String SPARQL)
"Assumes that the query is creating an RDF graph with the " +
"CONSTRUCT keyword"
)
public String sparqlConstructRemote(String url, String SPARQL)
public Model sparqlConstructRemote(String url, String SPARQL)
throws BioclipseException;

@Recorded
Expand Down
Expand Up @@ -383,29 +383,27 @@ public StringMatrix sparqlRemote(
return table;
}

public String sparqlConstructRemote(
String serviceURL,
String sparqlQueryString, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();

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 Model sparqlConstructRemote(
String serviceURL,
String sparqlQueryString, IProgressMonitor monitor) {

if (monitor == null)
monitor = new NullProgressMonitor();
Model results = null;

monitor.beginTask("Sparqling the remote service..", 100);
Query query = QueryFactory.create(sparqlQueryString);
QueryExecution qexec = QueryExecutionFactory.sparqlService(serviceURL, query);
monitor.worked(80);

try {
results = qexec.execConstruct();
} finally {
qexec.close();
}
monitor.worked(20);
return results;

This comment has been minimized.

Copy link
@egonw

egonw Sep 16, 2010

Should monitor.done() not be included somewhere too? (not sure, really... wondering though...)

This comment has been minimized.

Copy link
@samuell

samuell Sep 16, 2010

Author Owner

Well, probably true ... I just copied from the sparql method, so I didn't tough this stuff much at all

}

public IRDFStore importRDFa(IRDFStore store, String url,
IProgressMonitor monitor)
Expand Down

0 comments on commit bf7473f

Please sign in to comment.