-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug19847: support BNode usage in a federation
<release-note> bug19847: support BNode usage in a federation Previously, exceptions would be thrown when BNodes were created or returned in results from a federation; this was partly due to BNode creation requiring writes to the read-only federation. With this change, the client can create BNodes locally, and results that contain blank nodes will parse to BNodes without throwing an exception. </release-note> Added FederationTests to prepush tests make prepush passes ant tutorial runs Change-Id: Ic4dda508924f9780a89334c20e047ece64bd3edd Reviewed-on: https://gerrit.franz.com:9080/994 Reviewed-by: Mike Hinchey <mhinchey@franz.com> Reviewed-by: Ahmon Dancy <dancy@franz.com> Tested-by: Kevin Layer <layer@franz.com>
- Loading branch information
Showing
5 changed files
with
60 additions
and
19 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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/****************************************************************************** | ||
** Copyright (c) 2008-2010 Franz Inc. | ||
** All rights reserved. This program and the accompanying materials | ||
** are made available under the terms of the Eclipse Public License v1.0 | ||
** which accompanies this distribution, and is available at | ||
** http://www.eclipse.org/legal/epl-v10.html | ||
******************************************************************************/ | ||
|
||
package test; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.openrdf.model.BNode; | ||
import org.openrdf.model.vocabulary.RDF; | ||
import org.openrdf.query.BindingSet; | ||
import org.openrdf.query.QueryLanguage; | ||
import org.openrdf.query.TupleQueryResult; | ||
import org.openrdf.repository.RepositoryException; | ||
|
||
import com.franz.agraph.repository.AGRepositoryConnection; | ||
import com.franz.agraph.repository.AGTupleQuery; | ||
import com.franz.agraph.repository.AGVirtualRepository; | ||
|
||
public class FederationTests extends AGAbstractTest { | ||
|
||
@Test | ||
@Category(TestSuites.Prepush.class) | ||
public void federationBNodes() throws Exception { | ||
BNode bnode = vf.createBNode(); | ||
conn.add(bnode, RDF.TYPE, vf.createURI("http://Foo")); | ||
AGVirtualRepository fed = server.federate(repo,repo); | ||
AGRepositoryConnection conn2 = fed.getConnection(); | ||
// Should be able to create BNodes for a federation | ||
conn2.getValueFactory().createBNode(); | ||
conn2.getValueFactory().createBNode("foo"); | ||
try { | ||
conn2.add(bnode, RDF.TYPE, vf.createURI("http://Boo")); | ||
Assert.fail("expected can't write to federation."); | ||
} catch (RepositoryException e) { | ||
//expected | ||
} | ||
AGTupleQuery q = conn2.prepareTupleQuery(QueryLanguage.SPARQL, "select ?s {?s ?p ?o}"); | ||
TupleQueryResult result = q.evaluate(); | ||
Assert.assertTrue(result.hasNext()); | ||
BindingSet bind = result.next(); | ||
Assert.assertEquals(bnode.stringValue(), bind.getValue("s").stringValue()); | ||
} | ||
|
||
} |
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