-
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.
rfe10447: add AGGraphQuery#count() method
<release-note> rfe10447: add AGGraphQuery#count() method With this change, the java client now supports counting for graph queries (e.g CONSTRUCT and DESCRIBE) with the AGGraphQuery#count() method. Also added javadoc for the AGTupleQuery#count() method. </release-note> Added AGGraphQueryTests to prepush tests. make prepush passes. make javadoc runs clean. Change-Id: Ifbf3069dbc544dccf103d41533335824929770d0 Reviewed-on: https://gerrit.franz.com:9080/1273 Reviewed-by: John O'Rourke <jor@franz.com> Reviewed-by: Ahmon Dancy <dancy@franz.com> Tested-by: Kevin Layer <layer@franz.com>
- Loading branch information
Showing
4 changed files
with
75 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/****************************************************************************** | ||
** 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 java.io.File; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.openrdf.query.QueryLanguage; | ||
|
||
import com.franz.agraph.repository.AGGraphQuery; | ||
import com.franz.agraph.repository.AGRDFFormat; | ||
|
||
public class AGGraphQueryTests extends AGAbstractTest { | ||
|
||
@Test | ||
@Category(TestSuites.Prepush.class) | ||
public void graphQuery_count_rfe10447() throws Exception { | ||
conn.add(new File("src/test/example.nq"), null, AGRDFFormat.NQUADS); | ||
String queryString = "construct {?s ?p ?o} where {?s ?p ?o}"; | ||
AGGraphQuery q = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString); | ||
Assert.assertEquals("expected size 10", 10, q.count()); | ||
queryString = | ||
"construct {?s ?p ?o} where " + | ||
"{GRAPH <http://example.org/alice/foaf.rdf> {?s ?p ?o}}"; | ||
q = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString); | ||
Assert.assertEquals("expected size 7", 7, q.count()); | ||
queryString = | ||
"construct {?s ?p ?o} where " + | ||
"{GRAPH <http://example.org/bob/foaf.rdf> {?s ?p ?o}}"; | ||
q = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString); | ||
Assert.assertEquals("expected size 3", 3, q.count()); | ||
queryString = | ||
"construct {?s ?p ?o} where " + | ||
"{GRAPH <http://example.org/carol/foaf.rdf> {?s ?p ?o}}"; | ||
q = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString); | ||
Assert.assertEquals("expected size 0", 0, q.count()); | ||
queryString = | ||
"describe <http://example.org/alice/foaf.rdf#me>"; | ||
q = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString); | ||
Assert.assertEquals("expected size 7", 7, q.count()); | ||
} | ||
|
||
} |
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