From: <tho...@us...> - 2014-11-17 22:11:22
|
Revision: 8715 http://sourceforge.net/p/bigdata/code/8715 Author: thompsonbry Date: 2014-11-17 22:11:08 +0000 (Mon, 17 Nov 2014) Log Message: ----------- Test suite and other bug fixes related to RDR support for 1.4.0 release. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_4_0/bigdata/src/releases/RELEASE_1_4_0.txt branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/impl/sail/AbstractSailGraphTestCase.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/ServiceProviderHook.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParser.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserFactory.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstruct.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstructFactory.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriter.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterFactory.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstruct.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstructFactory.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONParserBase.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONWriterBase.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/ntriples/BigdataNTriplesParserFactory.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParser.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParserFactory.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriter.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriterFactory.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/graph/impl/bd/AbstractBigdataGraphTestCase.java branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestNTriplesWithSids.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttlx branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttlx Removed Paths: ------------- branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttl branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttl Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata/src/releases/RELEASE_1_4_0.txt =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata/src/releases/RELEASE_1_4_0.txt 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata/src/releases/RELEASE_1_4_0.txt 2014-11-17 22:11:08 UTC (rev 8715) @@ -51,16 +51,17 @@ 1.4.0: -- http://trac.bigdata.com/ticket/714 (Migrate to openrdf 2.7) -- http://trac.bigdata.com/ticket/745 (BackgroundTupleResult overrides final method close) -- http://trac.bigdata.com/ticket/813 (Documentation on BigData Reasoning) -- http://trac.bigdata.com/ticket/911 (workbench does not display errors well) -- http://trac.bigdata.com/ticket/1035 (DISTINCT PREDICATEs query is slow) -- http://trac.bigdata.com/ticket/1037 (SELECT COUNT(...) (DISTINCT|REDUCED) {single-triple-pattern} is slow) -- http://trac.bigdata.com/ticket/1044 (ORDER_BY ordering not preserved by projection operator) -- http://trac.bigdata.com/ticket/1047 (NQuadsParser hangs when loading latest dbpedia dump.) -- http://trac.bigdata.com/ticket/1052 (ASTComplexOptionalOptimizer did not account for Values clauses) -- http://trac.bigdata.com/ticket/1054 (BigdataGraphFactory create method cannot be invoked from the gremlin command line due to a Boolean vs boolean type mismatch.) +- http://trac.bigdata.com/ticket/714 (Migrate to openrdf 2.7) +- http://trac.bigdata.com/ticket/745 (BackgroundTupleResult overrides final method close) +- http://trac.bigdata.com/ticket/813 (Documentation on BigData Reasoning) +- http://trac.bigdata.com/ticket/911 (workbench does not display errors well) +- http://trac.bigdata.com/ticket/1035 (DISTINCT PREDICATEs query is slow) +- http://trac.bigdata.com/ticket/1037 (SELECT COUNT(...) (DISTINCT|REDUCED) {single-triple-pattern} is slow) +- http://trac.bigdata.com/ticket/1044 (ORDER_BY ordering not preserved by projection operator) +- http://trac.bigdata.com/ticket/1047 (NQuadsParser hangs when loading latest dbpedia dump.) +- http://trac.bigdata.com/ticket/1052 (ASTComplexOptionalOptimizer did not account for Values clauses) +- http://trac.bigdata.com/ticket/1054 (BigdataGraphFactory create method cannot be invoked from the gremlin command line due to a Boolean vs boolean type mismatch.) +- http://trac.bigdata.com/ticket/1061 (Server does not generate RDR aware JSON for RDF/SPARQL RESULTS) 1.3.4: Deleted: branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttl =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttl 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttl 2014-11-17 22:11:08 UTC (rev 8715) @@ -1,41 +0,0 @@ -# A graph using the RDR syntax to express link weights. -# -@prefix bd: <http://www.bigdata.com/> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix foaf: <http://xmlns.com/foaf/0.1/> . - - bd:1 foaf:knows bd:2 . -<<bd:1 foaf:knows bd:2 >> bd:weight "100"^^xsd:int . - -# Note: This uses a different link type. if the link type constraint is -# not respected, then the hops and weighted distance between (1) and -# (5) will be wrong (the hops will become 1 instead of 2, the weighted -# distance will be 100-23=77 less than expected.) - bd:1 foaf:knows2 bd:5 . -<<bd:1 foaf:knows2 bd:5 >> bd:weight "13"^^xsd:int . - -# This vertex property should be ignored by traversal if the test sets up -# a constraint that only "links" are visited by the GAS traversal. - bd:1 rdf:label "blue" . - -# Note: This uses a different link attribute type for the weight. if the -# link attribute type is used and not restricted to bd:weight2, then this -# link will be "visible" and the weighted distance between (1) and (2) will -# change. -#<<bd:1 foaf:knows bd:2 >> bd:weight2 "7"^^xsd:int . - - bd:1 foaf:knows bd:3 . -<<bd:1 foaf:knows bd:3 >> bd:weight "100"^^xsd:int . - - bd:2 foaf:knows bd:4 . -<<bd:2 foaf:knows bd:4 >> bd:weight "50"^^xsd:int . - - bd:3 foaf:knows bd:4 . -<<bd:3 foaf:knows bd:4 >> bd:weight "100"^^xsd:int . - - bd:3 foaf:knows bd:5 . -<<bd:3 foaf:knows bd:5 >> bd:weight "100"^^xsd:int . - - bd:4 foaf:knows bd:5 . -<<bd:4 foaf:knows bd:5 >> bd:weight "25"^^xsd:int . Added: branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttlx =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttlx (rev 0) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttlx 2014-11-17 22:11:08 UTC (rev 8715) @@ -0,0 +1,41 @@ +# A graph using the RDR syntax to express link weights. +# +@prefix bd: <http://www.bigdata.com/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . + + bd:1 foaf:knows bd:2 . +<<bd:1 foaf:knows bd:2 >> bd:weight "100"^^xsd:int . + +# Note: This uses a different link type. if the link type constraint is +# not respected, then the hops and weighted distance between (1) and +# (5) will be wrong (the hops will become 1 instead of 2, the weighted +# distance will be 100-23=77 less than expected.) + bd:1 foaf:knows2 bd:5 . +<<bd:1 foaf:knows2 bd:5 >> bd:weight "13"^^xsd:int . + +# This vertex property should be ignored by traversal if the test sets up +# a constraint that only "links" are visited by the GAS traversal. + bd:1 rdf:label "blue" . + +# Note: This uses a different link attribute type for the weight. if the +# link attribute type is used and not restricted to bd:weight2, then this +# link will be "visible" and the weighted distance between (1) and (2) will +# change. +#<<bd:1 foaf:knows bd:2 >> bd:weight2 "7"^^xsd:int . + + bd:1 foaf:knows bd:3 . +<<bd:1 foaf:knows bd:3 >> bd:weight "100"^^xsd:int . + + bd:2 foaf:knows bd:4 . +<<bd:2 foaf:knows bd:4 >> bd:weight "50"^^xsd:int . + + bd:3 foaf:knows bd:4 . +<<bd:3 foaf:knows bd:4 >> bd:weight "100"^^xsd:int . + + bd:3 foaf:knows bd:5 . +<<bd:3 foaf:knows bd:5 >> bd:weight "100"^^xsd:int . + + bd:4 foaf:knows bd:5 . +<<bd:4 foaf:knows bd:5 >> bd:weight "25"^^xsd:int . Deleted: branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttl =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttl 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttl 2014-11-17 22:11:08 UTC (rev 8715) @@ -1,20 +0,0 @@ -@prefix : <http://www.bigdata.com/ssspGraph/> . - -# Source, Target, Weight -# -------------------------------- -# 1 2 1.00 -# 1 3 1.00 -# 2 4 0.50 -# 3 4 1.00 -# 3 5 1.00 -# 4 5 0.25 - -# FIXME This does not have the link weights! Express as reified statements -# or using RDR. Or allow loading of trivial sparse matrix formats for the -# tests and use an assumed link type for all links. - -:1 :link :2 . -:1 :link :3 . -:2 :link :4 . -:3 :link :4 . -:4 :link :5 . Added: branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttlx =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttlx (rev 0) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttlx 2014-11-17 22:11:08 UTC (rev 8715) @@ -0,0 +1,20 @@ +@prefix : <http://www.bigdata.com/ssspGraph/> . + +# Source, Target, Weight +# -------------------------------- +# 1 2 1.00 +# 1 3 1.00 +# 2 4 0.50 +# 3 4 1.00 +# 3 5 1.00 +# 4 5 0.25 + +# FIXME This does not have the link weights! Express as reified statements +# or using RDR. Or allow loading of trivial sparse matrix formats for the +# tests and use an assumed link type for all links. + +:1 :link :2 . +:1 :link :3 . +:2 :link :4 . +:3 :link :4 . +:4 :link :5 . Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/impl/sail/AbstractSailGraphTestCase.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/impl/sail/AbstractSailGraphTestCase.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-gas/src/test/com/bigdata/rdf/graph/impl/sail/AbstractSailGraphTestCase.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -202,8 +202,8 @@ /** * The data file. */ - static private final String ssspGraph1 = "bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttl"; - static private final String ssspGraph2 = "src/test/com/bigdata/rdf/graph/data/ssspGraph.ttl"; + static private final String ssspGraph1 = "bigdata-gas/src/test/com/bigdata/rdf/graph/data/ssspGraph.ttlx"; + static private final String ssspGraph2 = "src/test/com/bigdata/rdf/graph/data/ssspGraph.ttlx"; public final URI link, v1, v2, v3, v4, v5; Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/ServiceProviderHook.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/ServiceProviderHook.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/ServiceProviderHook.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -29,13 +29,19 @@ import info.aduna.lang.service.ServiceRegistry; +import java.nio.charset.Charset; +import java.util.Arrays; import java.util.ServiceLoader; +import org.apache.log4j.Logger; import org.openrdf.query.QueryLanguage; import org.openrdf.query.resultio.TupleQueryResultParserRegistry; +import org.openrdf.query.resultio.TupleQueryResultWriterFactory; import org.openrdf.query.resultio.TupleQueryResultWriterRegistry; import org.openrdf.rio.RDFFormat; +import org.openrdf.rio.RDFParserFactory; import org.openrdf.rio.RDFParserRegistry; +import org.openrdf.rio.RDFWriterFactory; import org.openrdf.rio.RDFWriterRegistry; import com.bigdata.rdf.model.StatementEnum; @@ -80,28 +86,124 @@ * loader problems </a> * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public class ServiceProviderHook { + private static final Logger log = Logger.getLogger(ServiceProviderHook.class); + static private boolean loaded = false; static { + + /* + * Note: These MUST be declared before the forceLoad() call or they will + * be NULL when that method runs. + */ + + TURTLE_RDR = new RDFFormat("Turtle-RDR", + Arrays.asList("application/x-turtle-RDR"), + Charset.forName("UTF-8"), Arrays.asList("ttlx"), true, false); + + NTRIPLES_RDR = new RDFFormat("N-Triples-RDR", + "application/x-n-triples-RDR", Charset.forName("US-ASCII"), + "ntx", false, false); + + JSON_RDR = new RDFFormat("SPARQL/JSON", Arrays.asList( + "application/sparql-results+json", "application/json"), + Charset.forName("UTF-8"), Arrays.asList("srj", "json"), + RDFFormat.NO_NAMESPACES, RDFFormat.SUPPORTS_CONTEXTS); + forceLoad(); + } + + /** + * The extension MIME type for RDR data interchange using the RDR extension + * of TURTLE. + * + * @see <a href="http://trac.bigdata.com/ticket/1038" >RDR RDF parsers not + * always discovered </a> + * @see http://wiki.bigdata.com/wiki/index.php/Reification_Done_Right + */ + public static final RDFFormat TURTLE_RDR; + + /** + * The extension MIME type for RDR data interchange using the RDR extension + * of N-TRIPLES. + * + * @see <a href="http://trac.bigdata.com/ticket/1038" >RDR RDF parsers not + * always discovered </a> + * @see http://wiki.bigdata.com/wiki/index.php/Reification_Done_Right + */ + public static final RDFFormat NTRIPLES_RDR; + + /** + * The extension MIME type for RDR aware data interchange of RDF and SPARQL + * result stes using JSON. + */ + public static final RDFFormat JSON_RDR; /** - * This hook may be used to force the load of this class so it can ensure - * that the bigdata version of a service provider is used instead of the - * openrdf version. This is NOT optional. Without this hook, we do not have - * control over which version is resolved last in the processed - * <code>META-INF/services</code> files. - */ + * This hook may be used to force the load of this class so it can ensure + * that the bigdata version of a service provider is used instead of the + * openrdf version. This is NOT optional. Without this hook, we do not have + * control over which version is resolved last in the processed + * <code>META-INF/services</code> files. + * <p> + * Note: We need to use a synchronized pattern in order to ensure that any + * threads contending for this method awaits its completion. It would not + * be enough for a thread to know that the method was running. The thread + * needs to wait until the method is done. + */ synchronized static public void forceLoad() { if (loaded) return; - /* + log.warn("Running."); + + if (log.isInfoEnabled()) { + + for (RDFFormat f : RDFFormat.values()) { + log.info("RDFFormat: before: " + f); + } + for (RDFParserFactory f : RDFParserRegistry.getInstance().getAll()) { + log.info("RDFParserFactory: before: " + f); + } + for (RDFWriterFactory f : RDFWriterRegistry.getInstance().getAll()) { + log.info("RDFWriterFactory: before: " + f); + } + for (TupleQueryResultWriterFactory f : TupleQueryResultWriterRegistry + .getInstance().getAll()) { + log.info("TupleQueryResultWriterFactory: before: " + f); + } + + } +// /* +// * Force load of the openrdf service registry before we load our own +// * classes. +// */ +// { +// final String className = "info.aduna.lang.service.ServiceRegistry"; +// try { +// Class.forName(className); +// } catch (ClassNotFoundException ex) { +// log.error(ex); +// } +// } +// +// RDFFormat.register(NTRIPLES_RDR); +// RDFFormat.register(TURTLE_RDR); + + /* + * Register our RDFFormats. + * + * Note: They are NOT registered automatically by their constructors. + */ + RDFFormat.register(TURTLE_RDR); + RDFFormat.register(NTRIPLES_RDR); + RDFFormat.register(JSON_RDR); + + /* * Force the class loader to resolve the register, which will cause it * to be populated with the service provides as declared in the various * META-INF/services/serviceIface files. @@ -112,16 +214,14 @@ { final RDFParserRegistry r = RDFParserRegistry.getInstance(); - -// r.add(new BigdataRDFXMLParserFactory()); - -// // Note: This ensures that the RDFFormat for NQuads is loaded. -// r.get(RDFFormat.NQUADS); - - r.add(new BigdataNTriplesParserFactory()); + + // RDR-enabled + r.add(new BigdataNTriplesParserFactory()); + assert r.has(new BigdataNTriplesParserFactory().getRDFFormat()); - // subclassed the turtle parser for RDR + // RDR-enabled r.add(new BigdataTurtleParserFactory()); + assert r.has(new BigdataTurtleParserFactory().getRDFFormat()); /* * Allows parsing of JSON SPARQL Results with an {s,p,o,[c]} header. @@ -180,9 +280,26 @@ // r.add(new PropertiesTextWriterFactory()); // // } - + + if (log.isInfoEnabled()) { + for (RDFFormat f : RDFFormat.values()) { + log.info("RDFFormat: after: " + f); + } + for (RDFParserFactory f : RDFParserRegistry.getInstance().getAll()) { + log.info("RDFParserFactory: after: " + f); + } + for (RDFWriterFactory f : RDFWriterRegistry.getInstance().getAll()) { + log.info("RDFWriterFactory: after: " + f); + } + for (TupleQueryResultWriterFactory f : TupleQueryResultWriterRegistry.getInstance().getAll()) { + log.info("TupleQueryResultWriterFactory: after: " + f); + } + } + loaded = true; } +// private static void registerFactory + } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParser.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParser.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParser.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -45,9 +45,6 @@ * @see <a href="http://www.w3.org/TR/sparql11-results-json/">SPARQL 1.1 Query * Results JSON Format</a> * @author Peter Ansell - * - * @deprecated We now use the openrdf versions of the JSON parser / writer. The - * bigdata specific versions will go away in the future. */ public class BigdataSPARQLResultsJSONParser extends SPARQLJSONParserBase implements TupleQueryResultParser { Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserFactory.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserFactory.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -19,15 +19,13 @@ import org.openrdf.query.resultio.TupleQueryResultFormat; import org.openrdf.query.resultio.TupleQueryResultParser; import org.openrdf.query.resultio.TupleQueryResultParserFactory; +import org.openrdf.query.resultio.sparqljson.SPARQLResultsJSONParser; /** * A {@link TupleQueryResultParserFactory} for parsers of SPARQL-1.1 JSON Tuple * Query Results. * * @author Peter Ansell - * - * @deprecated We now use the openrdf versions of the JSON parser / writer. The - * bigdata specific versions will go away in the future. */ public class BigdataSPARQLResultsJSONParserFactory implements TupleQueryResultParserFactory { Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstruct.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstruct.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstruct.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -38,6 +38,8 @@ import org.openrdf.rio.RDFParser; import org.openrdf.rio.helpers.RDFParserBase; +import com.bigdata.rdf.ServiceProviderHook; + /** * Parser for SPARQL-1.1 JSON Results Format documents * @@ -61,7 +63,7 @@ @Override public RDFFormat getRDFFormat() { - return BigdataSPARQLResultsJSONWriterForConstructFactory.JSON; + return ServiceProviderHook.JSON_RDR; } @Override Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstructFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstructFactory.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONParserForConstructFactory.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -21,6 +21,8 @@ import org.openrdf.rio.RDFParser; import org.openrdf.rio.RDFParserFactory; +import com.bigdata.rdf.ServiceProviderHook; + /** * A {@link TupleQueryResultParserFactory} for parsers of SPARQL-1.1 JSON Tuple * Query Results. @@ -28,8 +30,6 @@ * @author Peter Ansell */ public class BigdataSPARQLResultsJSONParserForConstructFactory implements RDFParserFactory { - - public static final RDFFormat JSON = BigdataSPARQLResultsJSONWriterForConstructFactory.JSON; @Override public RDFParser getParser() { @@ -38,7 +38,7 @@ @Override public RDFFormat getRDFFormat() { - return JSON; + return ServiceProviderHook.JSON_RDR; } } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriter.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriter.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriter.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -32,9 +32,6 @@ * A TupleQueryResultWriter that writes query results in the <a * href="http://www.w3.org/TR/rdf-sparql-json-res/">SPARQL Query Results JSON * Format</a>. - * - * @deprecated We now use the openrdf versions of the JSON parser / writer. The - * bigdata specific versions will go away in the future. */ public class BigdataSPARQLResultsJSONWriter extends SPARQLJSONWriterBase implements TupleQueryResultWriter { Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterFactory.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterFactory.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -33,6 +33,7 @@ /** * Returns {@link TupleQueryResultFormat#JSON}. */ + @Override public TupleQueryResultFormat getTupleQueryResultFormat() { return TupleQueryResultFormat.JSON; } @@ -40,6 +41,7 @@ /** * Returns a new instance of SPARQLResultsJSONWriter. */ + @Override public TupleQueryResultWriter getWriter(OutputStream out) { return new BigdataSPARQLResultsJSONWriter(out); } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstruct.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstruct.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstruct.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -32,6 +32,8 @@ import org.openrdf.rio.RioSetting; import org.openrdf.rio.WriterConfig; +import com.bigdata.rdf.ServiceProviderHook; + /** * A TupleQueryResultWriter that writes query results in the <a * href="http://www.w3.org/TR/rdf-sparql-json-res/">SPARQL Query Results JSON @@ -59,7 +61,7 @@ @Override public RDFFormat getRDFFormat() { - return BigdataSPARQLResultsJSONWriterForConstructFactory.JSON; + return ServiceProviderHook.JSON_RDR; } @@ -80,8 +82,11 @@ @Override public void endRDF() throws RDFHandlerException { try { - writer.endDocument(); - } catch (IOException e) { + writer.endQueryResult(); +// writer.endDocument(); +// } catch (IOException e) { +// throw new RDFHandlerException(e); + } catch (TupleQueryResultHandlerException e) { throw new RDFHandlerException(e); } } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstructFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstructFactory.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/BigdataSPARQLResultsJSONWriterForConstructFactory.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -18,15 +18,15 @@ import java.io.OutputStream; import java.io.Writer; -import java.nio.charset.Charset; -import java.util.Arrays; import org.openrdf.query.resultio.TupleQueryResultWriterFactory; import org.openrdf.rio.RDFFormat; import org.openrdf.rio.RDFWriter; import org.openrdf.rio.RDFWriterFactory; +import com.bigdata.rdf.ServiceProviderHook; + /** * A {@link TupleQueryResultWriterFactory} for writers of SPARQL/JSON query * results. @@ -38,18 +38,10 @@ // public static final RDFFormat JSON = new RDFFormat("N-Triples", "text/plain", // Charset.forName("US-ASCII"), "nt", NO_NAMESPACES, NO_CONTEXTS); - /** - * SPARQL Query Results JSON Format. - */ - public static final RDFFormat JSON = new RDFFormat("SPARQL/JSON", Arrays.asList( - "application/sparql-results+json", "application/json"), Charset.forName("UTF-8"), Arrays.asList( - "srj", "json"), RDFFormat.NO_NAMESPACES, RDFFormat.SUPPORTS_CONTEXTS); - - @Override public RDFFormat getRDFFormat() { - return JSON; - } + return ServiceProviderHook.JSON_RDR; + } @Override public RDFWriter getWriter(final Writer writer) { @@ -60,4 +52,5 @@ public RDFWriter getWriter(final OutputStream out) { return new BigdataSPARQLResultsJSONWriterForConstruct(out); } + } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONParserBase.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONParserBase.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONParserBase.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -42,12 +42,14 @@ /** * Abstract base class for SPARQL Results JSON Parsers. Provides a common * implementation of both boolean and tuple parsing. - * + * <p> * Bigdata Changes: - * - Changed the visibility of the method parseValue() from private to protected - * so we could override it. - * - Pulled some code out of parseQueryResultInternal into its own method so - * that we can override it. + * <ul> + * <li>Changed the visibility of the method parseValue() from private to + * protected so we could override it.</li> + * <li>Pulled some code out of parseQueryResultInternal into its own method so + * that we can override it.</li> + * </ul> * * @author Peter Ansell * @author Sebastian Schaffert Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONWriterBase.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONWriterBase.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/json/SPARQLJSONWriterBase.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -47,11 +47,13 @@ /** * An abstract class to implement the base functionality for both * SPARQLBooleanJSONWriter and SPARQLResultsJSONWriter. + * <p> + * Bigdata Changes: + * <ul> + * <li>Changed the visibility of JsonGenerator jg from private to protected so + * we can use it in a subclass.</li> + * </ul> * - * Bigdata Changes: - * - Changed the visibility of JsonGenerator jg from private to protected - * so we can use it in a subclass. - * * @author Peter Ansell */ abstract class SPARQLJSONWriterBase extends QueryResultWriterBase implements QueryResultWriter { Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/ntriples/BigdataNTriplesParserFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/ntriples/BigdataNTriplesParserFactory.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/ntriples/BigdataNTriplesParserFactory.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -9,24 +9,30 @@ import org.openrdf.rio.RDFParser; import org.openrdf.rio.RDFParserFactory; +import com.bigdata.rdf.ServiceProviderHook; + /** - * An {@link RDFParserFactory} for N-Triples parsers. + * An RDR-aware {@link RDFParserFactory} for N-Triples parsers. * * @author Arjohn Kampman * @openrdf + * + * @see http://wiki.bigdata.com/wiki/index.php/Reification_Done_Right */ public class BigdataNTriplesParserFactory implements RDFParserFactory { /** - * Returns {@link RDFFormat#NTRIPLES}. + * Returns {@link RDFFormat#NTRIPLES_RDR}. */ + @Override public RDFFormat getRDFFormat() { - return RDFFormat.NTRIPLES; + return ServiceProviderHook.NTRIPLES_RDR; } /** * Returns a new instance of BigdataNTriplesParser. */ + @Override public RDFParser getParser() { return new BigdataNTriplesParser(); } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParser.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParser.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParser.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -15,7 +15,6 @@ import org.openrdf.model.Value; import org.openrdf.rio.RDFHandlerException; import org.openrdf.rio.RDFParseException; -import org.openrdf.rio.helpers.BasicParserSettings; import org.openrdf.rio.turtle.TurtleParser; import org.openrdf.rio.turtle.TurtleUtil; Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParserFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParserFactory.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleParserFactory.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -10,24 +10,33 @@ import org.openrdf.rio.RDFParserFactory; import org.openrdf.rio.turtle.TurtleParser; +import com.bigdata.rdf.ServiceProviderHook; + /** - * An {@link RDFParserFactory} for Turtle parsers. + * An RDR-aware {@link RDFParserFactory} for Turtle parsers. * * @author Arjohn Kampman * @openrdf + * + * @see http://wiki.bigdata.com/wiki/index.php/Reification_Done_Right */ public class BigdataTurtleParserFactory implements RDFParserFactory { /** - * Returns {@link RDFFormat#TURTLE}. + * Returns {@link ServiceProviderHook#TURTLE_RDR}. + * + * @see <a href="http://trac.bigdata.com/ticket/1038" >RDR RDF parsers not + * always discovered </a> */ + @Override public RDFFormat getRDFFormat() { - return RDFFormat.TURTLE; + return ServiceProviderHook.TURTLE_RDR; } /** * Returns a new instance of {@link TurtleParser}. */ + @Override public RDFParser getParser() { return new BigdataTurtleParser(); } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriter.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriter.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriter.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -20,6 +20,7 @@ * An implementation of the RDFWriter interface that writes RDF documents in * Turtle format. The Turtle format is defined in <a * href="http://www.dajobe.org/2004/01/turtle/">in this document</a>. + * @openrdf */ public class BigdataTurtleWriter extends TurtleWriter implements RDFWriter { Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriterFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriterFactory.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/turtle/BigdataTurtleWriterFactory.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -12,31 +12,42 @@ import org.openrdf.rio.RDFWriter; import org.openrdf.rio.RDFWriterFactory; +import com.bigdata.rdf.ServiceProviderHook; + /** - * An {@link RDFWriterFactory} for Turtle writers. + * An RDR-aware {@link RDFWriterFactory} for Turtle writers. * * @author Arjohn Kampman + * @openrdf + * + * @see http://wiki.bigdata.com/wiki/index.php/Reification_Done_Right */ public class BigdataTurtleWriterFactory implements RDFWriterFactory { /** - * Returns {@link RDFFormat#TURTLE}. + * Returns {@link ServiceProviderHook#TURTLE_RDR}. + * + * @see <a href="http://trac.bigdata.com/ticket/1038" >RDR RDF parsers not + * always discovered </a> */ + @Override public RDFFormat getRDFFormat() { - return RDFFormat.TURTLE; + return ServiceProviderHook.TURTLE_RDR; } /** * Returns a new instance of {@link BigdataTurtleWriter}. */ - public RDFWriter getWriter(OutputStream out) { + @Override + public RDFWriter getWriter(final OutputStream out) { return new BigdataTurtleWriter(out); } /** * Returns a new instance of {@link BigdataTurtleWriter}. */ - public RDFWriter getWriter(Writer writer) { + @Override + public RDFWriter getWriter(final Writer writer) { return new BigdataTurtleWriter(writer); } } Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/graph/impl/bd/AbstractBigdataGraphTestCase.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/graph/impl/bd/AbstractBigdataGraphTestCase.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/graph/impl/bd/AbstractBigdataGraphTestCase.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -202,7 +202,7 @@ /** * The data file. */ - static private final String smallWeightedGraph = "bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttl"; + static private final String smallWeightedGraph = "bigdata-gas/src/test/com/bigdata/rdf/graph/data/smallWeightedGraph.ttlx"; private final BigdataURI foafKnows, linkWeight, v1, v2, v3, v4, v5; Modified: branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestNTriplesWithSids.java =================================================================== --- branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestNTriplesWithSids.java 2014-11-17 19:29:53 UTC (rev 8714) +++ branches/BIGDATA_RELEASE_1_4_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestNTriplesWithSids.java 2014-11-17 22:11:08 UTC (rev 8715) @@ -11,6 +11,7 @@ import org.openrdf.rio.RDFParseException; import org.openrdf.rio.RDFParserRegistry; +import com.bigdata.rdf.ServiceProviderHook; import com.bigdata.rdf.axioms.NoAxioms; import com.bigdata.rdf.model.BigdataStatement; import com.bigdata.rdf.model.BigdataURI; @@ -98,13 +99,13 @@ // Verify that the correct parser will be used. assertEquals("NTriplesParserClass", BigdataNTriplesParser.class.getName(), RDFParserRegistry - .getInstance().get(RDFFormat.NTRIPLES).getParser() + .getInstance().get(ServiceProviderHook.NTRIPLES_RDR).getParser() .getClass().getName()); final DataLoader dataLoader = store.getDataLoader(); final LoadStats loadStats = dataLoader.loadData(new StringReader( - data), getName()/* baseURL */, RDFFormat.NTRIPLES); + data), getName()/* baseURL */, ServiceProviderHook.NTRIPLES_RDR); if (log.isInfoEnabled()) log.info(store.dumpStore()); @@ -249,13 +250,13 @@ // Verify that the correct parser will be used. assertEquals("NTriplesParserClass", BigdataNTriplesParser.class.getName(), RDFParserRegistry - .getInstance().get(RDFFormat.NTRIPLES).getParser() + .getInstance().get(ServiceProviderHook.NTRIPLES_RDR).getParser() .getClass().getName()); final DataLoader dataLoader = store.getDataLoader(); final LoadStats loadStats = dataLoader.loadData(new StringReader( - data), getName()/* baseURL */, RDFFormat.NTRIPLES); + data), getName()/* baseURL */, ServiceProviderHook.NTRIPLES_RDR); if (log.isInfoEnabled()) log.info(store.dumpStore()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |