Revision 50271
Added by Alessia Bardi over 6 years ago
VirtuosoTest.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import org.apache.jena.graph.NodeFactory; |
7 | 7 |
import org.apache.jena.graph.Triple; |
8 |
import org.apache.jena.query.Query; |
|
9 |
import org.apache.jena.query.QueryExecutionFactory; |
|
10 |
import org.apache.jena.query.QueryFactory; |
|
8 | 11 |
import org.apache.jena.rdf.model.Model; |
9 | 12 |
import org.apache.jena.rdf.model.ResourceFactory; |
13 |
import org.apache.jena.sparql.engine.http.QueryEngineHTTP; |
|
10 | 14 |
import org.apache.jena.util.iterator.ExtendedIterator; |
11 | 15 |
import org.junit.Assert; |
12 | 16 |
import org.junit.Before; |
... | ... | |
47 | 51 |
} |
48 | 52 |
|
49 | 53 |
@Test |
54 |
public void testDescribe(){ |
|
55 |
//put something in the graph |
|
56 |
Model md = VirtModel.openDatabaseModel(testGraph, connectionString, testUser, testPwd); |
|
57 |
md.read(getResourceAsStream("eu/dnetlib/parthenos/virtuoso/test.rdf"), defaultURIBaseURl); |
|
58 |
String resURI = "http://www.parthenos-project.eu/ARIADNE/ARIADNECatalog/Dataset/http%3A%2F%2Fregistry.ariadne-infrastructure.eu%2Fdataset%2F25058478"; |
|
59 |
//now query for the resource URI |
|
60 |
String describeQuery = "DESCRIBE <"+resURI+">"; |
|
61 |
Query query = QueryFactory.create(describeQuery) ; |
|
62 |
final QueryEngineHTTP serviceRequest = QueryExecutionFactory.createServiceRequest("http://localhost:8890/sparql", query); |
|
63 |
Model resultModel = serviceRequest.execDescribe(); |
|
64 |
serviceRequest.close(); |
|
65 |
resultModel.write(System.out); |
|
66 |
VirtGraph graph = new VirtGraph(testGraph, connectionString, testUser, testPwd); |
|
67 |
graph.clear(); |
|
68 |
} |
|
69 |
|
|
70 |
@Test |
|
50 | 71 |
public void testClear() { |
51 | 72 |
VirtGraph graph = new VirtGraph(testGraph, connectionString, testUser, testPwd); |
52 | 73 |
assertNotNull(graph); |
... | ... | |
154 | 175 |
} |
155 | 176 |
|
156 | 177 |
|
178 |
|
|
179 |
|
|
157 | 180 |
private InputStream getResourceAsStream(final String classpath) { |
158 | 181 |
try { |
159 | 182 |
final ClassPathResource resource = new ClassPathResource(classpath); |
Also available in: Unified diff
Testing Virtuoso DESCRIBE remote queries.