@@ -301,4 +301,52 @@ public void testZeroLengthPath_length2_crossRepository() throws Exception {
301
301
302
302
}
303
303
304
+ @ Test
305
+ public void testPropertyPath_sourceSelection_crossRepository () throws Exception {
306
+
307
+ prepareTest (Arrays .asList ("/tests/basic/data_emptyStore.ttl" , "/tests/basic/data_emptyStore.ttl" ));
308
+
309
+ Repository repo1 = getRepository (1 );
310
+ Repository repo2 = getRepository (2 );
311
+
312
+ try (RepositoryConnection con = repo1 .getConnection ()) {
313
+ con .add (Values .iri ("http://example.org/A" ), RDFS .SUBCLASSOF , Values .iri ("http://example.org/B" ),
314
+ Values .iri ("http://example.org/graph1" ));
315
+ }
316
+
317
+ try (RepositoryConnection con = repo2 .getConnection ()) {
318
+ con .add (Values .iri ("http://example.org/B" ), RDFS .SUBCLASSOF , Values .iri ("http://example.org/C" ),
319
+ Values .iri ("http://example.org/graph2" ));
320
+ }
321
+
322
+ Repository fedxRepo = fedxRule .getRepository ();
323
+
324
+ // 1a: bound (matching) object
325
+ try (RepositoryConnection con = fedxRepo .getConnection ()) {
326
+ TupleQuery tupleQuery = con .prepareTupleQuery (
327
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
328
+ + "SELECT * WHERE { "
329
+ + " ?subClass (rdfs:subClassOf+) <http://example.org/C> . "
330
+ + " } "
331
+ );
332
+
333
+ Assertions .assertEquals (2 , QueryResults .asSet (tupleQuery .evaluate ()).size ());
334
+ }
335
+
336
+ // 1b: with named graph
337
+ try (RepositoryConnection con = fedxRepo .getConnection ()) {
338
+ TupleQuery tupleQuery = con .prepareTupleQuery (
339
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
340
+ + "SELECT * WHERE { "
341
+ + " GRAPH <http://example.org/graph2> {"
342
+ + " ?subClass (rdfs:subClassOf+) <http://example.org/C> . "
343
+ + " }"
344
+ + "} "
345
+ );
346
+
347
+ Assertions .assertEquals (1 , QueryResults .asSet (tupleQuery .evaluate ()).size ());
348
+ }
349
+
350
+ }
351
+
304
352
}
0 commit comments