Further rebranding to Elephas
Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/49c4cffe Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/49c4cffe Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/49c4cffe Branch: refs/heads/master Commit: 49c4cffe6ab67a810955db286633ced5798cfc3f Parents: a6c0fef Author: Rob Vesse <[email protected]> Authored: Mon Jan 5 15:05:55 2015 +0000 Committer: Rob Vesse <[email protected]> Committed: Mon Jan 5 15:05:55 2015 +0000 ---------------------------------------------------------------------- jena-elephas/LICENSE | 176 +++++ jena-elephas/NOTICE | 5 + jena-elephas/jena-elephas-common/pom.xml | 54 ++ .../rdf/types/AbstractNodeTupleWritable.java | 193 +++++ .../rdf/types/CharacteristicSetWritable.java | 298 ++++++++ .../rdf/types/CharacteristicWritable.java | 160 ++++ .../hadoop/rdf/types/NodeTupleWritable.java | 80 ++ .../jena/hadoop/rdf/types/NodeWritable.java | 188 +++++ .../jena/hadoop/rdf/types/QuadWritable.java | 136 ++++ .../jena/hadoop/rdf/types/TripleWritable.java | 138 ++++ .../comparators/SimpleBinaryComparator.java | 34 + .../rdf/types/converters/ThriftConverter.java | 147 ++++ .../rdf/io/types/CharacteristicTests.java | 210 +++++ .../jena/hadoop/rdf/io/types/RdfTypesTest.java | 406 ++++++++++ jena-elephas/jena-elephas-io/pom.xml | 67 ++ .../jena/hadoop/rdf/io/HadoopIOConstants.java | 49 ++ .../jena/hadoop/rdf/io/RdfIOConstants.java | 81 ++ .../io/input/AbstractNLineFileInputFormat.java | 70 ++ .../io/input/AbstractWholeFileInputFormat.java | 42 + .../hadoop/rdf/io/input/QuadsInputFormat.java | 46 ++ .../hadoop/rdf/io/input/TriplesInputFormat.java | 42 + .../rdf/io/input/TriplesOrQuadsInputFormat.java | 47 ++ .../io/input/jsonld/JsonLDQuadInputFormat.java | 39 + .../input/jsonld/JsonLDTripleInputFormat.java | 39 + .../input/nquads/BlockedNQuadsInputFormat.java | 53 ++ .../rdf/io/input/nquads/NQuadsInputFormat.java | 46 ++ .../nquads/WholeFileNQuadsInputFormat.java | 51 ++ .../ntriples/BlockedNTriplesInputFormat.java | 53 ++ .../io/input/ntriples/NTriplesInputFormat.java | 46 ++ .../ntriples/WholeFileNTriplesInputFormat.java | 51 ++ .../io/input/rdfjson/RdfJsonInputFormat.java | 46 ++ .../rdf/io/input/rdfxml/RdfXmlInputFormat.java | 46 ++ .../AbstractBlockBasedNodeTupleReader.java | 344 +++++++++ .../readers/AbstractBlockBasedQuadReader.java | 51 ++ .../readers/AbstractBlockBasedTripleReader.java | 51 ++ .../AbstractLineBasedNodeTupleReader.java | 265 +++++++ .../readers/AbstractLineBasedQuadReader.java | 50 ++ .../readers/AbstractLineBasedTripleReader.java | 51 ++ .../rdf/io/input/readers/AbstractRdfReader.java | 108 +++ .../AbstractWholeFileNodeTupleReader.java | 328 ++++++++ .../readers/AbstractWholeFileQuadReader.java | 51 ++ .../readers/AbstractWholeFileTripleReader.java | 51 ++ .../rdf/io/input/readers/QuadsReader.java | 49 ++ .../io/input/readers/TriplesOrQuadsReader.java | 72 ++ .../rdf/io/input/readers/TriplesReader.java | 49 ++ .../io/input/readers/TriplesToQuadsReader.java | 102 +++ .../input/readers/jsonld/JsonLDQuadReader.java | 32 + .../readers/jsonld/JsonLDTripleReader.java | 30 + .../readers/nquads/BlockedNQuadsReader.java | 45 ++ .../io/input/readers/nquads/NQuadsReader.java | 49 ++ .../readers/nquads/WholeFileNQuadsReader.java | 42 + .../readers/ntriples/BlockedNTriplesReader.java | 45 ++ .../input/readers/ntriples/NTriplesReader.java | 48 ++ .../ntriples/WholeFileNTriplesReader.java | 42 + .../io/input/readers/rdfjson/RdfJsonReader.java | 37 + .../io/input/readers/rdfxml/RdfXmlReader.java | 37 + .../input/readers/thrift/ThriftQuadReader.java | 32 + .../readers/thrift/ThriftTripleReader.java | 30 + .../rdf/io/input/readers/trig/TriGReader.java | 37 + .../rdf/io/input/readers/trix/TriXReader.java | 37 + .../io/input/readers/turtle/TurtleReader.java | 37 + .../io/input/thrift/ThriftQuadInputFormat.java | 39 + .../input/thrift/ThriftTripleInputFormat.java | 39 + .../rdf/io/input/trig/TriGInputFormat.java | 46 ++ .../rdf/io/input/trix/TriXInputFormat.java | 42 + .../rdf/io/input/turtle/TurtleInputFormat.java | 46 ++ .../rdf/io/input/util/BlockInputStream.java | 94 +++ .../hadoop/rdf/io/input/util/RdfIOUtils.java | 101 +++ .../rdf/io/input/util/TrackableInputStream.java | 38 + .../rdf/io/input/util/TrackedInputStream.java | 124 +++ .../io/input/util/TrackedPipedQuadsStream.java | 55 ++ .../io/input/util/TrackedPipedRDFStream.java | 64 ++ .../input/util/TrackedPipedTriplesStream.java | 56 ++ .../AbstractBatchedNodeTupleOutputFormat.java | 55 ++ .../rdf/io/output/AbstractNodeOutputFormat.java | 94 +++ .../output/AbstractNodeTupleOutputFormat.java | 109 +++ .../AbstractStreamRdfNodeTupleOutputFormat.java | 73 ++ .../hadoop/rdf/io/output/QuadsOutputFormat.java | 64 ++ .../io/output/TriplesOrQuadsOutputFormat.java | 74 ++ .../rdf/io/output/TriplesOutputFormat.java | 61 ++ .../output/jsonld/JsonLDQuadOutputFormat.java | 44 ++ .../output/jsonld/JsonLDTripleOutputFormat.java | 44 ++ .../io/output/nquads/NQuadsOutputFormat.java | 52 ++ .../ntriples/NTriplesNodeOutputFormat.java | 45 ++ .../output/ntriples/NTriplesOutputFormat.java | 52 ++ .../io/output/rdfjson/RdfJsonOutputFormat.java | 52 ++ .../io/output/rdfxml/RdfXmlOutputFormat.java | 52 ++ .../output/thrift/ThriftQuadOutputFormat.java | 51 ++ .../output/thrift/ThriftTripleOutputFormat.java | 52 ++ .../io/output/trig/BatchedTriGOutputFormat.java | 54 ++ .../rdf/io/output/trig/TriGOutputFormat.java | 58 ++ .../rdf/io/output/trix/TriXOutputFormat.java | 57 ++ .../turtle/BatchedTurtleOutputFormat.java | 50 ++ .../io/output/turtle/TurtleOutputFormat.java | 56 ++ .../writers/AbstractBatchedNodeTupleWriter.java | 113 +++ .../writers/AbstractBatchedQuadWriter.java | 80 ++ .../writers/AbstractBatchedTripleWriter.java | 68 ++ .../AbstractLineBasedNodeTupleWriter.java | 152 ++++ .../writers/AbstractLineBasedQuadWriter.java | 71 ++ .../writers/AbstractLineBasedTripleWriter.java | 68 ++ .../io/output/writers/AbstractNodeWriter.java | 192 +++++ .../AbstractStreamRdfNodeTupleWriter.java | 71 ++ .../AbstractWholeFileNodeTupleWriter.java | 96 +++ .../writers/AbstractWholeFileQuadWriter.java | 66 ++ .../writers/AbstractWholeFileTripleWriter.java | 65 ++ .../io/output/writers/QuadsToTriplesWriter.java | 59 ++ .../io/output/writers/StreamRdfQuadWriter.java | 45 ++ .../output/writers/StreamRdfTripleWriter.java | 44 ++ .../output/writers/jsonld/JsonLDQuadWriter.java | 38 + .../writers/jsonld/JsonLDTripleWriter.java | 38 + .../io/output/writers/nquads/NQuadsWriter.java | 57 ++ .../writers/ntriples/NTriplesNodeWriter.java | 59 ++ .../output/writers/ntriples/NTriplesWriter.java | 58 ++ .../output/writers/rdfjson/RdfJsonWriter.java | 51 ++ .../io/output/writers/rdfxml/RdfXmlWriter.java | 51 ++ .../output/writers/thrift/ThriftQuadWriter.java | 38 + .../writers/thrift/ThriftTripleWriter.java | 38 + .../output/writers/trig/BatchedTriGWriter.java | 52 ++ .../writers/turtle/BatchedTurtleWriter.java | 54 ++ .../rdf/io/registry/HadoopRdfIORegistry.java | 310 ++++++++ .../hadoop/rdf/io/registry/ReaderFactory.java | 83 ++ .../hadoop/rdf/io/registry/WriterFactory.java | 96 +++ .../readers/AbstractQuadsOnlyReaderFactory.java | 83 ++ .../registry/readers/AbstractReaderFactory.java | 80 ++ .../AbstractTriplesOnlyReaderFactory.java | 83 ++ .../registry/readers/JsonLDReaderFactory.java | 49 ++ .../registry/readers/NQuadsReaderFactory.java | 42 + .../registry/readers/NTriplesReaderFactory.java | 38 + .../registry/readers/RdfJsonReaderFactory.java | 41 + .../registry/readers/RdfXmlReaderFactory.java | 40 + .../registry/readers/ThriftReaderFactory.java | 49 ++ .../io/registry/readers/TriGReaderFactory.java | 42 + .../io/registry/readers/TriXReaderFactory.java | 41 + .../registry/readers/TurtleReaderFactory.java | 40 + .../writers/AbstractQuadsOnlyWriterFactory.java | 86 +++ .../AbstractTriplesOnlyWriterFactory.java | 85 +++ .../registry/writers/AbstractWriterFactory.java | 82 ++ .../registry/writers/JsonLDWriterFactory.java | 52 ++ .../registry/writers/NQuadsWriterFactory.java | 44 ++ .../registry/writers/NTriplesWriterFactory.java | 44 ++ .../registry/writers/RdfJsonWriterFactory.java | 43 ++ .../registry/writers/RdfXmlWriterFactory.java | 44 ++ .../registry/writers/ThriftWriterFactory.java | 57 ++ .../io/registry/writers/TriGWriterFactory.java | 45 ++ .../io/registry/writers/TriXWriterFactory.java | 47 ++ .../registry/writers/TurtleWriterFactory.java | 45 ++ ...he.jena.hadoop.rdf.io.registry.ReaderFactory | 10 + ...he.jena.hadoop.rdf.io.registry.WriterFactory | 10 + .../rdf/io/RdfTriplesInputTestMapper.java | 47 ++ .../AbstractBlockedQuadInputFormatTests.java | 33 + .../AbstractBlockedTripleInputFormatTests.java | 33 + .../AbstractNodeTupleInputFormatTests.java | 612 +++++++++++++++ .../io/input/AbstractQuadsInputFormatTests.java | 70 ++ .../input/AbstractTriplesInputFormatTests.java | 72 ++ .../AbstractWholeFileQuadInputFormatTests.java | 115 +++ ...AbstractWholeFileTripleInputFormatTests.java | 108 +++ .../io/input/bnodes/AbstractBlankNodeTests.java | 636 ++++++++++++++++ .../bnodes/AbstractTripleBlankNodeTests.java | 65 ++ .../input/bnodes/JsonLdTripleBlankNodeTest.java | 63 ++ .../io/input/bnodes/NTriplesBlankNodeTest.java | 58 ++ .../io/input/bnodes/RdfJsonBlankNodeTest.java | 58 ++ .../io/input/bnodes/RdfThriftBlankNodeTest.java | 68 ++ .../io/input/bnodes/RdfXmlBlankNodeTest.java | 62 ++ .../io/input/bnodes/TurtleBlankNodeTest.java | 58 ++ ...ractCompressedNodeTupleInputFormatTests.java | 74 ++ ...AbstractCompressedQuadsInputFormatTests.java | 71 ++ ...stractCompressedTriplesInputFormatTests.java | 71 ++ ...CompressedWholeFileQuadInputFormatTests.java | 150 ++++ ...mpressedWholeFileTripleInputFormatTests.java | 144 ++++ ...actCompressedJsonLDQuadInputFormatTests.java | 74 ++ ...tCompressedJsonLDTripleInputFormatTests.java | 74 ++ .../jsonld/BZippedJsonLDQuadInputTest.java | 34 + .../jsonld/BZippedJsonLDTripleInputTest.java | 34 + .../jsonld/DeflatedJsonLDQuadInputTest.java | 34 + .../jsonld/DeflatedJsonLDTripleInputTest.java | 34 + .../jsonld/GZippedJsonLDQuadInputTest.java | 34 + .../jsonld/GZippedJsonLDTripleInputTest.java | 34 + ...bstractCompressedNQuadsInputFormatTests.java | 68 ++ ...mpressedWholeFileNQuadsInputFormatTests.java | 75 ++ .../nquads/BZipppedNQuadsInputTest.java | 38 + .../BZipppedWholeFileNQuadsInputTest.java | 37 + .../nquads/DeflatedNQuadsInputTest.java | 37 + .../DeflatedWholeFileNQuadsInputTest.java | 37 + .../nquads/GZippedNQuadsInputTest.java | 38 + .../nquads/GZippedWholeFileNQuadsInputTest.java | 38 + ...mpressedBlockedNTriplesInputFormatTests.java | 53 ++ ...tractCompressedNTriplesInputFormatTests.java | 68 ++ ...ressedWholeFileNTriplesInputFormatTests.java | 75 ++ .../ntriples/BZippedBlockedNTriplesInput.java | 37 + .../ntriples/BZippedNTriplesInputTest.java | 38 + .../BZippedWholeFileNTriplesInputTest.java | 38 + .../ntriples/DeflatedBlockedNTriplesInput.java | 37 + .../ntriples/DeflatedNTriplesInputTest.java | 38 + .../DeflatedWholeFileNTriplesInputTest.java | 38 + .../ntriples/GZippedBlockedNTriplesInput.java | 37 + .../ntriples/GZippedNTriplesInputTest.java | 41 + .../GZippedWholeFileNTriplesInputTest.java | 38 + ...stractCompressedRdfJsonInputFormatTests.java | 74 ++ .../rdfjson/BZippedRdfJsonInputTest.java | 37 + .../rdfjson/DeflatedRdfJsonInputTest.java | 37 + .../rdfjson/GZippedRdfJsonInputTest.java | 37 + ...bstractCompressedRdfXmlInputFormatTests.java | 75 ++ .../rdfxml/BZippedRdfXmlInputTest.java | 37 + .../rdfxml/DeflatedRdfXmlInputTest.java | 37 + .../rdfxml/GZippedRdfXmlInputTest.java | 37 + ...actCompressedThriftQuadInputFormatTests.java | 72 ++ ...tCompressedThriftTripleInputFormatTests.java | 72 ++ .../thrift/BZippedThriftQuadInputTest.java | 34 + .../thrift/BZippedThriftTripleInputTest.java | 34 + .../thrift/DeflatedThriftQuadInputTest.java | 34 + .../thrift/DeflatedThriftTripleInputTest.java | 34 + .../thrift/GZippedThriftQuadInputTest.java | 34 + .../thrift/GZippedThriftTripleInputTest.java | 34 + .../AbstractCompressedTriGInputFormatTests.java | 72 ++ .../compressed/trig/BZippedTriGInputTest.java | 37 + .../compressed/trig/DeflatedTriGInputTest.java | 37 + .../compressed/trig/GZippedTriGInputTest.java | 37 + .../AbstractCompressedTriXInputFormatTests.java | 72 ++ .../compressed/trix/BZippedTriXInputTest.java | 35 + .../compressed/trix/DeflatedTriXInputTest.java | 35 + .../compressed/trix/GZippedTriXInputTest.java | 35 + ...bstractCompressedTurtleInputFormatTests.java | 75 ++ .../turtle/BZippedTurtleInputTest.java | 37 + .../turtle/DeflatedTurtleInputTest.java | 37 + .../turtle/GZippedTurtleInputTest.java | 37 + .../io/input/jsonld/JsonLDQuadInputTest.java | 50 ++ .../io/input/jsonld/JsonLDTripleInputTest.java | 50 ++ .../io/input/nquads/BlockedNQuadsInputTest.java | 51 ++ .../rdf/io/input/nquads/NQuadsInputTest.java | 44 ++ .../input/nquads/WholeFileNQuadsInputTest.java | 51 ++ .../ntriples/BlockedNTriplesInputTest.java | 50 ++ .../io/input/ntriples/NTriplesInputTest.java | 44 ++ .../ntriples/WholeFileNTriplesInputTest.java | 52 ++ .../rdf/io/input/rdfjson/RdfJsonInputTest.java | 51 ++ .../rdf/io/input/rdfxml/RdfXmlInputTest.java | 51 ++ .../io/input/thrift/ThriftQuadInputTest.java | 51 ++ .../io/input/thrift/ThriftTripleInputTest.java | 51 ++ .../hadoop/rdf/io/input/trig/TriGInputTest.java | 50 ++ .../hadoop/rdf/io/input/trix/TriXInputTest.java | 50 ++ .../rdf/io/input/turtle/TurtleInputTest.java | 50 ++ .../util/AbstractTrackableInputStreamTests.java | 701 +++++++++++++++++ .../rdf/io/input/util/BlockInputStreamTest.java | 240 ++++++ .../io/input/util/TrackedInputStreamTest.java | 39 + .../AbstractNodeTupleOutputFormatTests.java | 255 +++++++ .../output/AbstractQuadOutputFormatTests.java | 51 ++ .../output/AbstractTripleOutputFormatTests.java | 47 ++ .../io/output/jsonld/JsonLdQuadOutputTest.java | 47 ++ .../output/jsonld/JsonLdTripleOutputTest.java | 47 ++ .../rdf/io/output/nquads/NQuadsOutputTest.java | 51 ++ .../io/output/ntriples/NTriplesOutputTest.java | 51 ++ .../io/output/rdfjson/RdfJsonOutputTest.java | 51 ++ .../rdf/io/output/rdfxml/RdfXmlOutputTest.java | 51 ++ .../io/output/thrift/ThriftQuadOutputTest.java | 48 ++ .../output/thrift/ThriftTripleOutputTest.java | 48 ++ .../io/output/trig/BatchedTriGOutputTest.java | 92 +++ .../io/output/trig/StreamedTriGOutputTest.java | 92 +++ .../output/trig/TriGBlankNodeOutputTests.java | 120 +++ .../rdf/io/output/trix/TriXOutputTest.java | 47 ++ .../output/turtle/BatchedTurtleOutputTest.java | 92 +++ .../output/turtle/StreamedTurtleOutputTest.java | 92 +++ .../turtle/TurtleBlankNodeOutputTests.java | 118 +++ .../io/registry/TestHadoopRdfIORegistry.java | 186 +++++ jena-elephas/jena-elephas-mapreduce/pom.xml | 87 +++ .../jena/hadoop/rdf/mapreduce/KeyMapper.java | 54 ++ .../hadoop/rdf/mapreduce/KeyPlusNullMapper.java | 55 ++ .../jena/hadoop/rdf/mapreduce/KeyReducer.java | 39 + .../hadoop/rdf/mapreduce/NullPlusKeyMapper.java | 55 ++ .../rdf/mapreduce/NullPlusKeyReducer.java | 59 ++ .../rdf/mapreduce/NullPlusValueMapper.java | 55 ++ .../rdf/mapreduce/NullPlusValueReducer.java | 64 ++ .../rdf/mapreduce/RdfMapReduceConstants.java | 67 ++ .../jena/hadoop/rdf/mapreduce/SwapMapper.java | 55 ++ .../jena/hadoop/rdf/mapreduce/SwapReducer.java | 43 ++ .../hadoop/rdf/mapreduce/TextCountReducer.java | 49 ++ .../jena/hadoop/rdf/mapreduce/ValueMapper.java | 54 ++ .../rdf/mapreduce/ValuePlusNullMapper.java | 55 ++ .../jena/hadoop/rdf/mapreduce/ValueReducer.java | 44 ++ ...tractCharacteristicSetGeneratingReducer.java | 179 +++++ .../CharacteristicSetReducer.java | 68 ++ .../QuadCharacteristicSetGeneratingReducer.java | 39 + ...ripleCharacteristicSetGeneratingReducer.java | 40 + .../count/AbstractNodeTupleNodeCountMapper.java | 66 ++ .../rdf/mapreduce/count/NodeCountReducer.java | 50 ++ .../mapreduce/count/QuadNodeCountMapper.java | 44 ++ .../mapreduce/count/TripleNodeCountMapper.java | 42 + .../datatypes/QuadDataTypeCountMapper.java | 56 ++ .../datatypes/TripleDataTypeCountMapper.java | 56 ++ .../AbstractNodeTupleNamespaceCountMapper.java | 135 ++++ .../namespaces/QuadNamespaceCountMapper.java | 44 ++ .../namespaces/TripleNamespaceCountMapper.java | 44 ++ .../count/positional/QuadObjectCountMapper.java | 42 + .../positional/QuadPredicateCountMapper.java | 42 + .../positional/QuadSubjectCountMapper.java | 41 + .../positional/TripleObjectCountMapper.java | 41 + .../positional/TriplePredicateCountMapper.java | 42 + .../positional/TripleSubjectCountMapper.java | 41 + .../filter/AbstractNodeTupleFilterMapper.java | 76 ++ .../filter/AbstractQuadFilterMapper.java | 35 + .../filter/AbstractTripleFilterMapper.java | 35 + .../filter/GroundQuadFilterMapper.java | 47 ++ .../filter/GroundTripleFilterMapper.java | 47 ++ .../mapreduce/filter/ValidQuadFilterMapper.java | 48 ++ .../filter/ValidTripleFilterMapper.java | 47 ++ .../AbstractQuadFilterByPositionMapper.java | 171 +++++ .../AbstractTripleFilterByPositionMapper.java | 141 ++++ .../positional/QuadFilterByGraphUriMapper.java | 76 ++ .../positional/QuadFilterByObjectUriMapper.java | 76 ++ .../positional/QuadFilterByPredicateMapper.java | 76 ++ .../QuadFilterBySubjectUriMapper.java | 76 ++ .../TripleFilterByObjectUriMapper.java | 71 ++ .../TripleFilterByPredicateUriMapper.java | 71 ++ .../TripleFilterBySubjectUriMapper.java | 71 ++ .../group/AbstractNodeTupleGroupingMapper.java | 60 ++ .../group/AbstractQuadGroupingMapper.java | 50 ++ .../group/AbstractTripleGroupingMapper.java | 44 ++ .../mapreduce/group/QuadGroupByGraphMapper.java | 39 + .../group/QuadGroupByObjectMapper.java | 39 + .../group/QuadGroupByPredicateMapper.java | 39 + .../group/QuadGroupBySubjectMapper.java | 39 + .../group/TripleGroupByObjectMapper.java | 41 + .../group/TripleGroupByPredicateMapper.java | 41 + .../group/TripleGroupBySubjectMapper.java | 41 + .../AbstractNodeTupleSplitToNodesMapper.java | 60 ++ .../AbstractNodeTupleSplitWithNodesMapper.java | 60 ++ .../mapreduce/split/QuadSplitToNodesMapper.java | 43 ++ .../split/QuadSplitWithNodesMapper.java | 43 ++ .../split/TripleSplitToNodesMapper.java | 41 + .../split/TripleSplitWithNodesMapper.java | 41 + .../transform/AbstractTriplesToQuadsMapper.java | 60 ++ .../transform/QuadsToTriplesMapper.java | 46 ++ .../TriplesToQuadsBySubjectMapper.java | 40 + .../TriplesToQuadsConstantGraphMapper.java | 75 ++ .../rdf/mapreduce/AbstractMapReduceTests.java | 69 ++ .../rdf/mapreduce/AbstractMapperTests.java | 69 ++ .../rdf/mapreduce/TestDistinctTriples.java | 129 ++++ ...CharacteristicSetGeneratingReducerTests.java | 185 +++++ .../CharacteristicSetReducerTest.java | 192 +++++ ...eCharacteristicSetGeneratingReducerTest.java | 59 ++ .../AbstractNodeTupleNodeCountReducedTests.java | 149 ++++ .../count/AbstractNodeTupleNodeCountTests.java | 138 ++++ .../count/QuadNodeCountMapReduceTest.java | 67 ++ .../count/QuadNodeCountMapperTest.java | 59 ++ .../count/TripleNodeCountMapReduceTest.java | 66 ++ .../count/TripleNodeCountMapperTest.java | 58 ++ .../filter/AbstractNodeTupleFilterTests.java | 146 ++++ .../filter/AbstractQuadValidityFilterTests.java | 86 +++ .../AbstractTripleValidityFilterTests.java | 73 ++ .../TripleFilterByNoPredicateMapperTest.java | 49 ++ .../TripleFilterByPredicateMapperTest.java | 80 ++ ...leInvertedFilterByNoPredicateMapperTest.java | 54 ++ ...ipleInvertedFilterByPredicateMapperTest.java | 87 +++ .../filter/ValidQuadFilterMapperTest.java | 40 + .../filter/ValidTripleFilterMapperTest.java | 40 + .../group/AbstractNodeTupleGroupingTests.java | 114 +++ .../group/AbstractQuadGroupingTests.java | 43 ++ .../group/AbstractTripleGroupingTests.java | 41 + .../group/QuadGroupByGraphMapperTest.java | 46 ++ .../group/QuadGroupByObjectMapperTest.java | 46 ++ .../group/QuadGroupByPredicateMapperTest.java | 46 ++ .../group/QuadGroupBySubjectMapperTest.java | 46 ++ .../group/TripleGroupByObjectMapperTest.java | 46 ++ .../group/TripleGroupByPredicateMapperTest.java | 46 ++ .../group/TripleGroupBySubjectMapperTest.java | 46 ++ .../AbstractNodeTupleSplitToNodesTests.java | 116 +++ .../AbstractNodeTupleSplitWithNodesTests.java | 116 +++ .../split/AbstractQuadSplitToNodesTests.java | 53 ++ .../split/AbstractQuadSplitWithNodesTests.java | 53 ++ .../split/AbstractTripleSplitToNodesTests.java | 52 ++ .../AbstractTripleSplitWithNodesTests.java | 52 ++ .../split/QuadSplitToNodesMapperTest.java | 41 + .../split/QuadSplitWithNodesMapperTest.java | 41 + .../split/TripleSplitToNodesMapperTest.java | 41 + .../split/TripleSplitWithNodesMapperTest.java | 42 + .../transform/QuadsToTriplesMapperTest.java | 113 +++ .../TriplesToQuadsBySubjectMapperTest.java | 113 +++ .../TriplesToQuadsConstantGraphMapperTest.java | 113 +++ jena-elephas/jena-elephas-stats/hadoop-job.xml | 46 ++ jena-elephas/jena-elephas-stats/pom.xml | 103 +++ .../apache/jena/hadoop/rdf/stats/RdfStats.java | 405 ++++++++++ .../jena/hadoop/rdf/stats/jobs/JobFactory.java | 757 +++++++++++++++++++ jena-elephas/pom.xml | 97 +++ jena-hadoop-rdf/LICENSE | 176 ----- jena-hadoop-rdf/NOTICE | 5 - jena-hadoop-rdf/hadoop-rdf-mapreduce/pom.xml | 87 --- .../jena/hadoop/rdf/mapreduce/KeyMapper.java | 54 -- .../hadoop/rdf/mapreduce/KeyPlusNullMapper.java | 55 -- .../jena/hadoop/rdf/mapreduce/KeyReducer.java | 39 - .../hadoop/rdf/mapreduce/NullPlusKeyMapper.java | 55 -- .../rdf/mapreduce/NullPlusKeyReducer.java | 59 -- .../rdf/mapreduce/NullPlusValueMapper.java | 55 -- .../rdf/mapreduce/NullPlusValueReducer.java | 64 -- .../rdf/mapreduce/RdfMapReduceConstants.java | 67 -- .../jena/hadoop/rdf/mapreduce/SwapMapper.java | 55 -- .../jena/hadoop/rdf/mapreduce/SwapReducer.java | 43 -- .../hadoop/rdf/mapreduce/TextCountReducer.java | 49 -- .../jena/hadoop/rdf/mapreduce/ValueMapper.java | 54 -- .../rdf/mapreduce/ValuePlusNullMapper.java | 55 -- .../jena/hadoop/rdf/mapreduce/ValueReducer.java | 44 -- ...tractCharacteristicSetGeneratingReducer.java | 179 ----- .../CharacteristicSetReducer.java | 68 -- .../QuadCharacteristicSetGeneratingReducer.java | 39 - ...ripleCharacteristicSetGeneratingReducer.java | 40 - .../count/AbstractNodeTupleNodeCountMapper.java | 66 -- .../rdf/mapreduce/count/NodeCountReducer.java | 50 -- .../mapreduce/count/QuadNodeCountMapper.java | 44 -- .../mapreduce/count/TripleNodeCountMapper.java | 42 - .../datatypes/QuadDataTypeCountMapper.java | 56 -- .../datatypes/TripleDataTypeCountMapper.java | 56 -- .../AbstractNodeTupleNamespaceCountMapper.java | 135 ---- .../namespaces/QuadNamespaceCountMapper.java | 44 -- .../namespaces/TripleNamespaceCountMapper.java | 44 -- .../count/positional/QuadObjectCountMapper.java | 42 - .../positional/QuadPredicateCountMapper.java | 42 - .../positional/QuadSubjectCountMapper.java | 41 - .../positional/TripleObjectCountMapper.java | 41 - .../positional/TriplePredicateCountMapper.java | 42 - .../positional/TripleSubjectCountMapper.java | 41 - .../filter/AbstractNodeTupleFilterMapper.java | 76 -- .../filter/AbstractQuadFilterMapper.java | 35 - .../filter/AbstractTripleFilterMapper.java | 35 - .../filter/GroundQuadFilterMapper.java | 47 -- .../filter/GroundTripleFilterMapper.java | 47 -- .../mapreduce/filter/ValidQuadFilterMapper.java | 48 -- .../filter/ValidTripleFilterMapper.java | 47 -- .../AbstractQuadFilterByPositionMapper.java | 171 ----- .../AbstractTripleFilterByPositionMapper.java | 141 ---- .../positional/QuadFilterByGraphUriMapper.java | 76 -- .../positional/QuadFilterByObjectUriMapper.java | 76 -- .../positional/QuadFilterByPredicateMapper.java | 76 -- .../QuadFilterBySubjectUriMapper.java | 76 -- .../TripleFilterByObjectUriMapper.java | 71 -- .../TripleFilterByPredicateUriMapper.java | 71 -- .../TripleFilterBySubjectUriMapper.java | 71 -- .../group/AbstractNodeTupleGroupingMapper.java | 60 -- .../group/AbstractQuadGroupingMapper.java | 50 -- .../group/AbstractTripleGroupingMapper.java | 44 -- .../mapreduce/group/QuadGroupByGraphMapper.java | 39 - .../group/QuadGroupByObjectMapper.java | 39 - .../group/QuadGroupByPredicateMapper.java | 39 - .../group/QuadGroupBySubjectMapper.java | 39 - .../group/TripleGroupByObjectMapper.java | 41 - .../group/TripleGroupByPredicateMapper.java | 41 - .../group/TripleGroupBySubjectMapper.java | 41 - .../AbstractNodeTupleSplitToNodesMapper.java | 60 -- .../AbstractNodeTupleSplitWithNodesMapper.java | 60 -- .../mapreduce/split/QuadSplitToNodesMapper.java | 43 -- .../split/QuadSplitWithNodesMapper.java | 43 -- .../split/TripleSplitToNodesMapper.java | 41 - .../split/TripleSplitWithNodesMapper.java | 41 - .../transform/AbstractTriplesToQuadsMapper.java | 60 -- .../transform/QuadsToTriplesMapper.java | 46 -- .../TriplesToQuadsBySubjectMapper.java | 40 - .../TriplesToQuadsConstantGraphMapper.java | 75 -- .../rdf/mapreduce/AbstractMapReduceTests.java | 69 -- .../rdf/mapreduce/AbstractMapperTests.java | 69 -- .../rdf/mapreduce/TestDistinctTriples.java | 129 ---- ...CharacteristicSetGeneratingReducerTests.java | 185 ----- .../CharacteristicSetReducerTest.java | 192 ----- ...eCharacteristicSetGeneratingReducerTest.java | 59 -- .../AbstractNodeTupleNodeCountReducedTests.java | 149 ---- .../count/AbstractNodeTupleNodeCountTests.java | 138 ---- .../count/QuadNodeCountMapReduceTest.java | 67 -- .../count/QuadNodeCountMapperTest.java | 59 -- .../count/TripleNodeCountMapReduceTest.java | 66 -- .../count/TripleNodeCountMapperTest.java | 58 -- .../filter/AbstractNodeTupleFilterTests.java | 146 ---- .../filter/AbstractQuadValidityFilterTests.java | 86 --- .../AbstractTripleValidityFilterTests.java | 73 -- .../TripleFilterByNoPredicateMapperTest.java | 49 -- .../TripleFilterByPredicateMapperTest.java | 80 -- ...leInvertedFilterByNoPredicateMapperTest.java | 54 -- ...ipleInvertedFilterByPredicateMapperTest.java | 87 --- .../filter/ValidQuadFilterMapperTest.java | 40 - .../filter/ValidTripleFilterMapperTest.java | 40 - .../group/AbstractNodeTupleGroupingTests.java | 114 --- .../group/AbstractQuadGroupingTests.java | 43 -- .../group/AbstractTripleGroupingTests.java | 41 - .../group/QuadGroupByGraphMapperTest.java | 46 -- .../group/QuadGroupByObjectMapperTest.java | 46 -- .../group/QuadGroupByPredicateMapperTest.java | 46 -- .../group/QuadGroupBySubjectMapperTest.java | 46 -- .../group/TripleGroupByObjectMapperTest.java | 46 -- .../group/TripleGroupByPredicateMapperTest.java | 46 -- .../group/TripleGroupBySubjectMapperTest.java | 46 -- .../AbstractNodeTupleSplitToNodesTests.java | 116 --- .../AbstractNodeTupleSplitWithNodesTests.java | 116 --- .../split/AbstractQuadSplitToNodesTests.java | 53 -- .../split/AbstractQuadSplitWithNodesTests.java | 53 -- .../split/AbstractTripleSplitToNodesTests.java | 52 -- .../AbstractTripleSplitWithNodesTests.java | 52 -- .../split/QuadSplitToNodesMapperTest.java | 41 - .../split/QuadSplitWithNodesMapperTest.java | 41 - .../split/TripleSplitToNodesMapperTest.java | 41 - .../split/TripleSplitWithNodesMapperTest.java | 42 - .../transform/QuadsToTriplesMapperTest.java | 113 --- .../TriplesToQuadsBySubjectMapperTest.java | 113 --- .../TriplesToQuadsConstantGraphMapperTest.java | 113 --- jena-hadoop-rdf/jena-elephas-common/pom.xml | 54 -- .../rdf/types/AbstractNodeTupleWritable.java | 193 ----- .../rdf/types/CharacteristicSetWritable.java | 298 -------- .../rdf/types/CharacteristicWritable.java | 160 ---- .../hadoop/rdf/types/NodeTupleWritable.java | 80 -- .../jena/hadoop/rdf/types/NodeWritable.java | 188 ----- .../jena/hadoop/rdf/types/QuadWritable.java | 136 ---- .../jena/hadoop/rdf/types/TripleWritable.java | 138 ---- .../comparators/SimpleBinaryComparator.java | 34 - .../rdf/types/converters/ThriftConverter.java | 147 ---- .../rdf/io/types/CharacteristicTests.java | 210 ----- .../jena/hadoop/rdf/io/types/RdfTypesTest.java | 406 ---------- jena-hadoop-rdf/jena-elephas-io/pom.xml | 67 -- .../jena/hadoop/rdf/io/HadoopIOConstants.java | 49 -- .../jena/hadoop/rdf/io/RdfIOConstants.java | 81 -- .../io/input/AbstractNLineFileInputFormat.java | 70 -- .../io/input/AbstractWholeFileInputFormat.java | 42 - .../hadoop/rdf/io/input/QuadsInputFormat.java | 46 -- .../hadoop/rdf/io/input/TriplesInputFormat.java | 42 - .../rdf/io/input/TriplesOrQuadsInputFormat.java | 47 -- .../io/input/jsonld/JsonLDQuadInputFormat.java | 39 - .../input/jsonld/JsonLDTripleInputFormat.java | 39 - .../input/nquads/BlockedNQuadsInputFormat.java | 53 -- .../rdf/io/input/nquads/NQuadsInputFormat.java | 46 -- .../nquads/WholeFileNQuadsInputFormat.java | 51 -- .../ntriples/BlockedNTriplesInputFormat.java | 53 -- .../io/input/ntriples/NTriplesInputFormat.java | 46 -- .../ntriples/WholeFileNTriplesInputFormat.java | 51 -- .../io/input/rdfjson/RdfJsonInputFormat.java | 46 -- .../rdf/io/input/rdfxml/RdfXmlInputFormat.java | 46 -- .../AbstractBlockBasedNodeTupleReader.java | 344 --------- .../readers/AbstractBlockBasedQuadReader.java | 51 -- .../readers/AbstractBlockBasedTripleReader.java | 51 -- .../AbstractLineBasedNodeTupleReader.java | 265 ------- .../readers/AbstractLineBasedQuadReader.java | 50 -- .../readers/AbstractLineBasedTripleReader.java | 51 -- .../rdf/io/input/readers/AbstractRdfReader.java | 108 --- .../AbstractWholeFileNodeTupleReader.java | 328 -------- .../readers/AbstractWholeFileQuadReader.java | 51 -- .../readers/AbstractWholeFileTripleReader.java | 51 -- .../rdf/io/input/readers/QuadsReader.java | 49 -- .../io/input/readers/TriplesOrQuadsReader.java | 72 -- .../rdf/io/input/readers/TriplesReader.java | 49 -- .../io/input/readers/TriplesToQuadsReader.java | 102 --- .../input/readers/jsonld/JsonLDQuadReader.java | 32 - .../readers/jsonld/JsonLDTripleReader.java | 30 - .../readers/nquads/BlockedNQuadsReader.java | 45 -- .../io/input/readers/nquads/NQuadsReader.java | 49 -- .../readers/nquads/WholeFileNQuadsReader.java | 42 - .../readers/ntriples/BlockedNTriplesReader.java | 45 -- .../input/readers/ntriples/NTriplesReader.java | 48 -- .../ntriples/WholeFileNTriplesReader.java | 42 - .../io/input/readers/rdfjson/RdfJsonReader.java | 37 - .../io/input/readers/rdfxml/RdfXmlReader.java | 37 - .../input/readers/thrift/ThriftQuadReader.java | 32 - .../readers/thrift/ThriftTripleReader.java | 30 - .../rdf/io/input/readers/trig/TriGReader.java | 37 - .../rdf/io/input/readers/trix/TriXReader.java | 37 - .../io/input/readers/turtle/TurtleReader.java | 37 - .../io/input/thrift/ThriftQuadInputFormat.java | 39 - .../input/thrift/ThriftTripleInputFormat.java | 39 - .../rdf/io/input/trig/TriGInputFormat.java | 46 -- .../rdf/io/input/trix/TriXInputFormat.java | 42 - .../rdf/io/input/turtle/TurtleInputFormat.java | 46 -- .../rdf/io/input/util/BlockInputStream.java | 94 --- .../hadoop/rdf/io/input/util/RdfIOUtils.java | 101 --- .../rdf/io/input/util/TrackableInputStream.java | 38 - .../rdf/io/input/util/TrackedInputStream.java | 124 --- .../io/input/util/TrackedPipedQuadsStream.java | 55 -- .../io/input/util/TrackedPipedRDFStream.java | 64 -- .../input/util/TrackedPipedTriplesStream.java | 56 -- .../AbstractBatchedNodeTupleOutputFormat.java | 55 -- .../rdf/io/output/AbstractNodeOutputFormat.java | 94 --- .../output/AbstractNodeTupleOutputFormat.java | 109 --- .../AbstractStreamRdfNodeTupleOutputFormat.java | 73 -- .../hadoop/rdf/io/output/QuadsOutputFormat.java | 64 -- .../io/output/TriplesOrQuadsOutputFormat.java | 74 -- .../rdf/io/output/TriplesOutputFormat.java | 61 -- .../output/jsonld/JsonLDQuadOutputFormat.java | 44 -- .../output/jsonld/JsonLDTripleOutputFormat.java | 44 -- .../io/output/nquads/NQuadsOutputFormat.java | 52 -- .../ntriples/NTriplesNodeOutputFormat.java | 45 -- .../output/ntriples/NTriplesOutputFormat.java | 52 -- .../io/output/rdfjson/RdfJsonOutputFormat.java | 52 -- .../io/output/rdfxml/RdfXmlOutputFormat.java | 52 -- .../output/thrift/ThriftQuadOutputFormat.java | 51 -- .../output/thrift/ThriftTripleOutputFormat.java | 52 -- .../io/output/trig/BatchedTriGOutputFormat.java | 54 -- .../rdf/io/output/trig/TriGOutputFormat.java | 58 -- .../rdf/io/output/trix/TriXOutputFormat.java | 57 -- .../turtle/BatchedTurtleOutputFormat.java | 50 -- .../io/output/turtle/TurtleOutputFormat.java | 56 -- .../writers/AbstractBatchedNodeTupleWriter.java | 113 --- .../writers/AbstractBatchedQuadWriter.java | 80 -- .../writers/AbstractBatchedTripleWriter.java | 68 -- .../AbstractLineBasedNodeTupleWriter.java | 152 ---- .../writers/AbstractLineBasedQuadWriter.java | 71 -- .../writers/AbstractLineBasedTripleWriter.java | 68 -- .../io/output/writers/AbstractNodeWriter.java | 192 ----- .../AbstractStreamRdfNodeTupleWriter.java | 71 -- .../AbstractWholeFileNodeTupleWriter.java | 96 --- .../writers/AbstractWholeFileQuadWriter.java | 66 -- .../writers/AbstractWholeFileTripleWriter.java | 65 -- .../io/output/writers/QuadsToTriplesWriter.java | 59 -- .../io/output/writers/StreamRdfQuadWriter.java | 45 -- .../output/writers/StreamRdfTripleWriter.java | 44 -- .../output/writers/jsonld/JsonLDQuadWriter.java | 38 - .../writers/jsonld/JsonLDTripleWriter.java | 38 - .../io/output/writers/nquads/NQuadsWriter.java | 57 -- .../writers/ntriples/NTriplesNodeWriter.java | 59 -- .../output/writers/ntriples/NTriplesWriter.java | 58 -- .../output/writers/rdfjson/RdfJsonWriter.java | 51 -- .../io/output/writers/rdfxml/RdfXmlWriter.java | 51 -- .../output/writers/thrift/ThriftQuadWriter.java | 38 - .../writers/thrift/ThriftTripleWriter.java | 38 - .../output/writers/trig/BatchedTriGWriter.java | 52 -- .../writers/turtle/BatchedTurtleWriter.java | 54 -- .../rdf/io/registry/HadoopRdfIORegistry.java | 310 -------- .../hadoop/rdf/io/registry/ReaderFactory.java | 83 -- .../hadoop/rdf/io/registry/WriterFactory.java | 96 --- .../readers/AbstractQuadsOnlyReaderFactory.java | 83 -- .../registry/readers/AbstractReaderFactory.java | 80 -- .../AbstractTriplesOnlyReaderFactory.java | 83 -- .../registry/readers/JsonLDReaderFactory.java | 49 -- .../registry/readers/NQuadsReaderFactory.java | 42 - .../registry/readers/NTriplesReaderFactory.java | 38 - .../registry/readers/RdfJsonReaderFactory.java | 41 - .../registry/readers/RdfXmlReaderFactory.java | 40 - .../registry/readers/ThriftReaderFactory.java | 49 -- .../io/registry/readers/TriGReaderFactory.java | 42 - .../io/registry/readers/TriXReaderFactory.java | 41 - .../registry/readers/TurtleReaderFactory.java | 40 - .../writers/AbstractQuadsOnlyWriterFactory.java | 86 --- .../AbstractTriplesOnlyWriterFactory.java | 85 --- .../registry/writers/AbstractWriterFactory.java | 82 -- .../registry/writers/JsonLDWriterFactory.java | 52 -- .../registry/writers/NQuadsWriterFactory.java | 44 -- .../registry/writers/NTriplesWriterFactory.java | 44 -- .../registry/writers/RdfJsonWriterFactory.java | 43 -- .../registry/writers/RdfXmlWriterFactory.java | 44 -- .../registry/writers/ThriftWriterFactory.java | 57 -- .../io/registry/writers/TriGWriterFactory.java | 45 -- .../io/registry/writers/TriXWriterFactory.java | 47 -- .../registry/writers/TurtleWriterFactory.java | 45 -- ...he.jena.hadoop.rdf.io.registry.ReaderFactory | 10 - ...he.jena.hadoop.rdf.io.registry.WriterFactory | 10 - .../rdf/io/RdfTriplesInputTestMapper.java | 47 -- .../AbstractBlockedQuadInputFormatTests.java | 33 - .../AbstractBlockedTripleInputFormatTests.java | 33 - .../AbstractNodeTupleInputFormatTests.java | 612 --------------- .../io/input/AbstractQuadsInputFormatTests.java | 70 -- .../input/AbstractTriplesInputFormatTests.java | 72 -- .../AbstractWholeFileQuadInputFormatTests.java | 115 --- ...AbstractWholeFileTripleInputFormatTests.java | 108 --- .../io/input/bnodes/AbstractBlankNodeTests.java | 636 ---------------- .../bnodes/AbstractTripleBlankNodeTests.java | 65 -- .../input/bnodes/JsonLdTripleBlankNodeTest.java | 63 -- .../io/input/bnodes/NTriplesBlankNodeTest.java | 58 -- .../io/input/bnodes/RdfJsonBlankNodeTest.java | 58 -- .../io/input/bnodes/RdfThriftBlankNodeTest.java | 68 -- .../io/input/bnodes/RdfXmlBlankNodeTest.java | 62 -- .../io/input/bnodes/TurtleBlankNodeTest.java | 58 -- ...ractCompressedNodeTupleInputFormatTests.java | 74 -- ...AbstractCompressedQuadsInputFormatTests.java | 71 -- ...stractCompressedTriplesInputFormatTests.java | 71 -- ...CompressedWholeFileQuadInputFormatTests.java | 150 ---- ...mpressedWholeFileTripleInputFormatTests.java | 144 ---- ...actCompressedJsonLDQuadInputFormatTests.java | 74 -- ...tCompressedJsonLDTripleInputFormatTests.java | 74 -- .../jsonld/BZippedJsonLDQuadInputTest.java | 34 - .../jsonld/BZippedJsonLDTripleInputTest.java | 34 - .../jsonld/DeflatedJsonLDQuadInputTest.java | 34 - .../jsonld/DeflatedJsonLDTripleInputTest.java | 34 - .../jsonld/GZippedJsonLDQuadInputTest.java | 34 - .../jsonld/GZippedJsonLDTripleInputTest.java | 34 - ...bstractCompressedNQuadsInputFormatTests.java | 68 -- ...mpressedWholeFileNQuadsInputFormatTests.java | 75 -- .../nquads/BZipppedNQuadsInputTest.java | 38 - .../BZipppedWholeFileNQuadsInputTest.java | 37 - .../nquads/DeflatedNQuadsInputTest.java | 37 - .../DeflatedWholeFileNQuadsInputTest.java | 37 - .../nquads/GZippedNQuadsInputTest.java | 38 - .../nquads/GZippedWholeFileNQuadsInputTest.java | 38 - ...mpressedBlockedNTriplesInputFormatTests.java | 53 -- ...tractCompressedNTriplesInputFormatTests.java | 68 -- ...ressedWholeFileNTriplesInputFormatTests.java | 75 -- .../ntriples/BZippedBlockedNTriplesInput.java | 37 - .../ntriples/BZippedNTriplesInputTest.java | 38 - .../BZippedWholeFileNTriplesInputTest.java | 38 - .../ntriples/DeflatedBlockedNTriplesInput.java | 37 - .../ntriples/DeflatedNTriplesInputTest.java | 38 - .../DeflatedWholeFileNTriplesInputTest.java | 38 - .../ntriples/GZippedBlockedNTriplesInput.java | 37 - .../ntriples/GZippedNTriplesInputTest.java | 41 - .../GZippedWholeFileNTriplesInputTest.java | 38 - ...stractCompressedRdfJsonInputFormatTests.java | 74 -- .../rdfjson/BZippedRdfJsonInputTest.java | 37 - .../rdfjson/DeflatedRdfJsonInputTest.java | 37 - .../rdfjson/GZippedRdfJsonInputTest.java | 37 - ...bstractCompressedRdfXmlInputFormatTests.java | 75 -- .../rdfxml/BZippedRdfXmlInputTest.java | 37 - .../rdfxml/DeflatedRdfXmlInputTest.java | 37 - .../rdfxml/GZippedRdfXmlInputTest.java | 37 - ...actCompressedThriftQuadInputFormatTests.java | 72 -- ...tCompressedThriftTripleInputFormatTests.java | 72 -- .../thrift/BZippedThriftQuadInputTest.java | 34 - .../thrift/BZippedThriftTripleInputTest.java | 34 - .../thrift/DeflatedThriftQuadInputTest.java | 34 - .../thrift/DeflatedThriftTripleInputTest.java | 34 - .../thrift/GZippedThriftQuadInputTest.java | 34 - .../thrift/GZippedThriftTripleInputTest.java | 34 - .../AbstractCompressedTriGInputFormatTests.java | 72 -- .../compressed/trig/BZippedTriGInputTest.java | 37 - .../compressed/trig/DeflatedTriGInputTest.java | 37 - .../compressed/trig/GZippedTriGInputTest.java | 37 - .../AbstractCompressedTriXInputFormatTests.java | 72 -- .../compressed/trix/BZippedTriXInputTest.java | 35 - .../compressed/trix/DeflatedTriXInputTest.java | 35 - .../compressed/trix/GZippedTriXInputTest.java | 35 - ...bstractCompressedTurtleInputFormatTests.java | 75 -- .../turtle/BZippedTurtleInputTest.java | 37 - .../turtle/DeflatedTurtleInputTest.java | 37 - .../turtle/GZippedTurtleInputTest.java | 37 - .../io/input/jsonld/JsonLDQuadInputTest.java | 50 -- .../io/input/jsonld/JsonLDTripleInputTest.java | 50 -- .../io/input/nquads/BlockedNQuadsInputTest.java | 51 -- .../rdf/io/input/nquads/NQuadsInputTest.java | 44 -- .../input/nquads/WholeFileNQuadsInputTest.java | 51 -- .../ntriples/BlockedNTriplesInputTest.java | 50 -- .../io/input/ntriples/NTriplesInputTest.java | 44 -- .../ntriples/WholeFileNTriplesInputTest.java | 52 -- .../rdf/io/input/rdfjson/RdfJsonInputTest.java | 51 -- .../rdf/io/input/rdfxml/RdfXmlInputTest.java | 51 -- .../io/input/thrift/ThriftQuadInputTest.java | 51 -- .../io/input/thrift/ThriftTripleInputTest.java | 51 -- .../hadoop/rdf/io/input/trig/TriGInputTest.java | 50 -- .../hadoop/rdf/io/input/trix/TriXInputTest.java | 50 -- .../rdf/io/input/turtle/TurtleInputTest.java | 50 -- .../util/AbstractTrackableInputStreamTests.java | 701 ----------------- .../rdf/io/input/util/BlockInputStreamTest.java | 240 ------ .../io/input/util/TrackedInputStreamTest.java | 39 - .../AbstractNodeTupleOutputFormatTests.java | 255 ------- .../output/AbstractQuadOutputFormatTests.java | 51 -- .../output/AbstractTripleOutputFormatTests.java | 47 -- .../io/output/jsonld/JsonLdQuadOutputTest.java | 47 -- .../output/jsonld/JsonLdTripleOutputTest.java | 47 -- .../rdf/io/output/nquads/NQuadsOutputTest.java | 51 -- .../io/output/ntriples/NTriplesOutputTest.java | 51 -- .../io/output/rdfjson/RdfJsonOutputTest.java | 51 -- .../rdf/io/output/rdfxml/RdfXmlOutputTest.java | 51 -- .../io/output/thrift/ThriftQuadOutputTest.java | 48 -- .../output/thrift/ThriftTripleOutputTest.java | 48 -- .../io/output/trig/BatchedTriGOutputTest.java | 92 --- .../io/output/trig/StreamedTriGOutputTest.java | 92 --- .../output/trig/TriGBlankNodeOutputTests.java | 120 --- .../rdf/io/output/trix/TriXOutputTest.java | 47 -- .../output/turtle/BatchedTurtleOutputTest.java | 92 --- .../output/turtle/StreamedTurtleOutputTest.java | 92 --- .../turtle/TurtleBlankNodeOutputTests.java | 118 --- .../io/registry/TestHadoopRdfIORegistry.java | 186 ----- .../jena-elephas-stats/hadoop-job.xml | 46 -- jena-hadoop-rdf/jena-elephas-stats/pom.xml | 103 --- .../apache/jena/hadoop/rdf/stats/RdfStats.java | 405 ---------- .../jena/hadoop/rdf/stats/jobs/JobFactory.java | 757 ------------------- jena-hadoop-rdf/pom.xml | 97 --- pom.xml | 4 +- 763 files changed, 28196 insertions(+), 28196 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/LICENSE ---------------------------------------------------------------------- diff --git a/jena-elephas/LICENSE b/jena-elephas/LICENSE new file mode 100644 index 0000000..68c771a --- /dev/null +++ b/jena-elephas/LICENSE @@ -0,0 +1,176 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/NOTICE ---------------------------------------------------------------------- diff --git a/jena-elephas/NOTICE b/jena-elephas/NOTICE new file mode 100644 index 0000000..f87b36f --- /dev/null +++ b/jena-elephas/NOTICE @@ -0,0 +1,5 @@ +Apache Jena +Copyright 2011-2014 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/jena-elephas-common/pom.xml ---------------------------------------------------------------------- diff --git a/jena-elephas/jena-elephas-common/pom.xml b/jena-elephas/jena-elephas-common/pom.xml new file mode 100644 index 0000000..7dd68a0 --- /dev/null +++ b/jena-elephas/jena-elephas-common/pom.xml @@ -0,0 +1,54 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.jena</groupId> + <artifactId>jena-elephas</artifactId> + <version>0.9.0-SNAPSHOT</version> + </parent> + <artifactId>jena-elephas-common</artifactId> + <name>Apache Jena - Elephas - Common API</name> + <description>Common code for RDF on Hadoop such as writable types for RDF primitives</description> + + <!-- Note that versions are managed by parent POMs --> + <dependencies> + <!-- Hadoop Dependencies --> + <!-- Note these will be provided on the Hadoop cluster hence the provided + scope --> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-common</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Jena dependencies --> + <dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-arq</artifactId> + </dependency> + + <!-- Test Dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java ---------------------------------------------------------------------- diff --git a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java new file mode 100644 index 0000000..f0acc09 --- /dev/null +++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java @@ -0,0 +1,193 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.hadoop.rdf.types; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.apache.hadoop.io.WritableComparable; +import org.apache.hadoop.io.WritableUtils; +import com.hp.hpl.jena.graph.Node; +import com.hp.hpl.jena.sparql.util.NodeUtils; + +/** + * A abstract general purpose writable where the actual class represented is + * composed of a number of {@link Node} instances + * <p> + * The binary encoding of this base implementation is just a variable integer + * indicating the number of nodes present followed by the binary encodings of + * the {@link NodeWritable} instances. Derived implementations may wish to + * override the {@link #readFields(DataInput)} and {@link #write(DataOutput)} + * methods in order to use more specialised encodings. + * </p> + * + * @param <T> + * Tuple type + */ +public abstract class AbstractNodeTupleWritable<T> implements WritableComparable<AbstractNodeTupleWritable<T>> { + + private T tuple; + + /** + * Creates a new empty instance + */ + protected AbstractNodeTupleWritable() { + this(null); + } + + /** + * Creates a new instance with the given value + * + * @param tuple + * Tuple value + */ + protected AbstractNodeTupleWritable(T tuple) { + this.tuple = tuple; + } + + /** + * Gets the tuple + * + * @return Tuple + */ + public T get() { + return this.tuple; + } + + /** + * Sets the tuple + * + * @param tuple + * Tuple + */ + public void set(T tuple) { + this.tuple = tuple; + } + + @Override + public void readFields(DataInput input) throws IOException { + // Determine how many nodes + int size = WritableUtils.readVInt(input); + Node[] ns = new Node[size]; + + NodeWritable nw = new NodeWritable(); + for (int i = 0; i < ns.length; i++) { + nw.readFields(input); + ns[i] = nw.get(); + } + + // Load the tuple + this.tuple = this.createTuple(ns); + } + + /** + * Creates the actual tuple type from an array of nodes + * + * @param ns + * Nodes + * @return Tuple + */ + protected abstract T createTuple(Node[] ns); + + @Override + public void write(DataOutput output) throws IOException { + // Determine how many nodes + Node[] ns = this.createNodes(this.tuple); + WritableUtils.writeVInt(output, ns.length); + + // Write out nodes + NodeWritable nw = new NodeWritable(); + for (int i = 0; i < ns.length; i++) { + nw.set(ns[i]); + nw.write(output); + } + } + + /** + * Sets the tuple value + * <p> + * Intended only for internal use i.e. when a derived implementation + * overrides {@link #readFields(DataInput)} and needs to set the tuple value + * directly i.e. when a derived implementation is using a custom encoding + * scheme + * </p> + * + * @param tuple + * Tuple + */ + protected final void setInternal(T tuple) { + this.tuple = tuple; + } + + /** + * Converts the actual tuple type into an array of nodes + * + * @param tuple + * Tuples + * @return Nodes + */ + protected abstract Node[] createNodes(T tuple); + + /** + * Compares instances node by node + * <p> + * Derived implementations may wish to override this and substitute native + * tuple based comparisons + * </p> + * + * @param other + * Instance to compare with + */ + @Override + public int compareTo(AbstractNodeTupleWritable<T> other) { + Node[] ns = this.createNodes(this.tuple); + Node[] otherNs = this.createNodes(other.tuple); + + if (ns.length < otherNs.length) { + return -1; + } else if (ns.length > otherNs.length) { + return 1; + } + // Compare node by node + for (int i = 0; i < ns.length; i++) { + int c = NodeUtils.compareRDFTerms(ns[i], otherNs[i]); + if (c != 0) + return c; + } + return 0; + } + + @Override + public String toString() { + return this.get().toString(); + } + + @Override + public int hashCode() { + return this.get().hashCode(); + } + + @SuppressWarnings("unchecked") + @Override + public boolean equals(Object other) { + if (!(other instanceof AbstractNodeTupleWritable)) + return false; + return this.compareTo((AbstractNodeTupleWritable<T>) other) == 0; + } +} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java ---------------------------------------------------------------------- diff --git a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java new file mode 100644 index 0000000..f29b156 --- /dev/null +++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java @@ -0,0 +1,298 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.hadoop.rdf.types; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; + +import org.apache.hadoop.io.LongWritable; +import org.apache.hadoop.io.WritableComparable; +import org.apache.hadoop.io.WritableUtils; + +import com.hp.hpl.jena.graph.Node; +import com.hp.hpl.jena.graph.NodeFactory; + +/** + * Represents a characteristic set which is comprised of a count of nodes for + * which the characteristic is applicable and a set of characteristics which + * represents the number of usages of predicates with those nodes + * + * + * + */ +public class CharacteristicSetWritable implements WritableComparable<CharacteristicSetWritable> { + + private Map<NodeWritable, CharacteristicWritable> characteristics = new TreeMap<NodeWritable, CharacteristicWritable>(); + private LongWritable count = new LongWritable(); + + /** + * Creates a new empty characteristic set with the default count of 1 + */ + public CharacteristicSetWritable() { + this(1); + } + + /** + * Creates a new characteristic set with the default count of 1 and the + * given characteristics + * + * @param characteristics + * Characteristics + */ + public CharacteristicSetWritable(CharacteristicWritable... characteristics) { + this(1, characteristics); + } + + /** + * Creates an empty characteristic set with the given count + * + * @param count + * Count + */ + public CharacteristicSetWritable(long count) { + this(count, new CharacteristicWritable[0]); + } + + /** + * Creates a new characteristic set + * + * @param count + * Count + * @param characteristics + * Characteristics + */ + public CharacteristicSetWritable(long count, CharacteristicWritable... characteristics) { + this.count.set(count); + for (CharacteristicWritable characteristic : characteristics) { + this.characteristics.put(characteristic.getNode(), characteristic); + } + } + + /** + * Creates a new instance and reads its data from the given input + * + * @param input + * Input + * @return New instance + * @throws IOException + */ + public static CharacteristicSetWritable read(DataInput input) throws IOException { + CharacteristicSetWritable set = new CharacteristicSetWritable(); + set.readFields(input); + return set; + } + + /** + * Gets the count + * + * @return Count + */ + public LongWritable getCount() { + return this.count; + } + + /** + * Gets the characteristics + * + * @return Characteristics + */ + public Iterator<CharacteristicWritable> getCharacteristics() { + return this.characteristics.values().iterator(); + } + + /** + * Gets the size of the characteristic set + * + * @return Size + */ + public int size() { + return this.characteristics.size(); + } + + /** + * Adds a characteristic to the set merging it into the appropriate existing + * characteristic if applicable + * + * @param characteristic + * Characteristics + */ + public void add(CharacteristicWritable characteristic) { + if (this.characteristics.containsKey(characteristic.getNode())) { + this.characteristics.get(characteristic.getNode()).increment(characteristic.getCount().get()); + } else { + this.characteristics.put(characteristic.getNode(), characteristic); + } + } + + /** + * Adds some characteristics to the set merging them with the appropriate + * existing characteristics if applicable + * + * @param characteristics + */ + public void add(CharacteristicWritable... characteristics) { + for (CharacteristicWritable characteristic : characteristics) { + this.add(characteristic); + } + } + + /** + * Adds the contents of the other characteristic set to this characteristic + * set + * + * @param set + * Characteristic set + */ + public void add(CharacteristicSetWritable set) { + this.increment(set.getCount().get()); + Iterator<CharacteristicWritable> iter = set.getCharacteristics(); + while (iter.hasNext()) { + this.add(iter.next()); + } + } + + /** + * Gets whether the set contains a characteristic for the given predicate + * + * @param uri + * Predicate URI + * @return True if contained in the set, false otherwise + */ + public boolean hasCharacteristic(String uri) { + return this.hasCharacteristic(NodeFactory.createURI(uri)); + } + + /** + * Gets whether the set contains a characteristic for the given predicate + * + * @param n + * Predicate + * @return True if contained in the set, false otherwise + */ + public boolean hasCharacteristic(Node n) { + return this.hasCharacteristic(new NodeWritable(n)); + } + + /** + * Gets whether the set contains a characteristic for the given predicate + * + * @param n + * Predicate + * @return True if contained in the set, false otherwise + */ + public boolean hasCharacteristic(NodeWritable n) { + return this.characteristics.containsKey(n); + } + + /** + * Increments the count by the given increment + * + * @param l + * Increment + */ + public void increment(long l) { + this.count.set(this.count.get() + l); + } + + @Override + public void write(DataOutput output) throws IOException { + // Write size, then count, then characteristics + WritableUtils.writeVInt(output, this.characteristics.size()); + this.count.write(output); + for (CharacteristicWritable characteristic : this.characteristics.values()) { + characteristic.write(output); + } + } + + @Override + public void readFields(DataInput input) throws IOException { + // Read size, then count, then characteristics + int size = WritableUtils.readVInt(input); + this.count.readFields(input); + this.characteristics.clear(); + for (int i = 0; i < size; i++) { + CharacteristicWritable cw = CharacteristicWritable.read(input); + this.characteristics.put(cw.getNode(), cw); + } + } + + @Override + public int compareTo(CharacteristicSetWritable cs) { + int size = this.characteristics.size(); + int otherSize = cs.characteristics.size(); + if (size < otherSize) { + return -1; + } else if (size > otherSize) { + return 1; + } else { + // Compare characteristics in turn + Iterator<CharacteristicWritable> iter = this.getCharacteristics(); + Iterator<CharacteristicWritable> otherIter = cs.getCharacteristics(); + + int compare = 0; + while (iter.hasNext()) { + CharacteristicWritable c = iter.next(); + CharacteristicWritable otherC = otherIter.next(); + compare = c.compareTo(otherC); + if (compare != 0) + return compare; + } + return compare; + } + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof CharacteristicSetWritable)) + return false; + return this.compareTo((CharacteristicSetWritable) other) == 0; + } + + @Override + public int hashCode() { + // Build a hash code from characteristics + if (this.characteristics.size() == 0) + return 0; + Iterator<CharacteristicWritable> iter = this.getCharacteristics(); + int hash = 17; + while (iter.hasNext()) { + hash = hash * 31 + iter.next().hashCode(); + } + return hash; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("{ "); + builder.append(this.count.get()); + Iterator<CharacteristicWritable> iter = this.getCharacteristics(); + while (iter.hasNext()) { + builder.append(" , "); + builder.append(iter.next().toString()); + } + builder.append(" }"); + return builder.toString(); + } + +} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java ---------------------------------------------------------------------- diff --git a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java new file mode 100644 index 0000000..90fc7db --- /dev/null +++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java @@ -0,0 +1,160 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.hadoop.rdf.types; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.hadoop.io.LongWritable; +import org.apache.hadoop.io.WritableComparable; + +import com.hp.hpl.jena.graph.Node; + +/** + * Represents a characteristic for a single node and contains the node and a + * count associated with that node + * <p> + * Note that characteristics are compared based upon only the nodes and not + * their counts + * </p> + * + * + * + */ +public class CharacteristicWritable implements WritableComparable<CharacteristicWritable> { + + private NodeWritable node = new NodeWritable(); + private LongWritable count = new LongWritable(); + + /** + * Creates an empty characteristic writable + */ + public CharacteristicWritable() { + this(null); + } + + /** + * Creates a characteristic writable with the given node and the default + * count of 1 + * + * @param n + * Node + */ + public CharacteristicWritable(Node n) { + this(n, 1); + } + + /** + * Creates a characteristic writable with the given node and count + * + * @param n + * Node + * @param count + * Count + */ + public CharacteristicWritable(Node n, long count) { + this.node.set(n); + this.count.set(count); + } + + /** + * Creates a new instance and reads in its data from the given input + * + * @param input + * Input + * @return New instance + * @throws IOException + */ + public static CharacteristicWritable read(DataInput input) throws IOException { + CharacteristicWritable cw = new CharacteristicWritable(); + cw.readFields(input); + return cw; + } + + /** + * Gets the node + * + * @return Node + */ + public NodeWritable getNode() { + return this.node; + } + + /** + * Gets the count + * + * @return Count + */ + public LongWritable getCount() { + return this.count; + } + + /** + * Increments the count by 1 + */ + public void increment() { + this.increment(1); + } + + /** + * Increments the count by the given value + * + * @param l + * Value to increment by + */ + public void increment(long l) { + this.count.set(this.count.get() + l); + } + + @Override + public void write(DataOutput output) throws IOException { + this.node.write(output); + this.count.write(output); + } + + @Override + public void readFields(DataInput input) throws IOException { + this.node.readFields(input); + this.count.readFields(input); + } + + @Override + public int compareTo(CharacteristicWritable o) { + return this.node.compareTo(o.node); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof CharacteristicWritable)) + return false; + return this.compareTo((CharacteristicWritable) other) == 0; + } + + @Override + public int hashCode() { + return this.node.hashCode(); + } + + @Override + public String toString() { + return "(" + this.node.toString() + ", " + this.count.toString() + ")"; + } + +} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java ---------------------------------------------------------------------- diff --git a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java new file mode 100644 index 0000000..e06aac4 --- /dev/null +++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.hadoop.rdf.types; + +import java.io.DataInput; +import java.io.IOException; + +import org.apache.jena.atlas.lib.Tuple; +import com.hp.hpl.jena.graph.Node; + +/** + * A writable RDF tuple + * <p> + * Unlike the more specific {@link TripleWritable} and {@link QuadWritable} this + * class allows for arbitrary length tuples and does not restrict tuples to + * being of uniform size. + * </p> + * + * + * + */ +public class NodeTupleWritable extends AbstractNodeTupleWritable<Tuple<Node>> { + + /** + * Creates a new empty instance + */ + public NodeTupleWritable() { + this(null); + } + + /** + * Creates a new instance with the given value + * + * @param tuple + * Tuple + */ + public NodeTupleWritable(Tuple<Node> tuple) { + super(tuple); + } + + /** + * Creates a new instance from the given input + * + * @param input + * Input + * @return New instance + * @throws IOException + */ + public static NodeTupleWritable read(DataInput input) throws IOException { + NodeTupleWritable t = new NodeTupleWritable(); + t.readFields(input); + return t; + } + + @Override + protected Tuple<Node> createTuple(Node[] ns) { + return Tuple.create(ns); + } + + @Override + protected Node[] createNodes(Tuple<Node> tuple) { + return tuple.tuple(); + } +} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java ---------------------------------------------------------------------- diff --git a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java new file mode 100644 index 0000000..cf00f8d --- /dev/null +++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java @@ -0,0 +1,188 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.hadoop.rdf.types; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.apache.hadoop.io.WritableComparable; +import org.apache.hadoop.io.WritableComparator; +import org.apache.jena.hadoop.rdf.types.comparators.SimpleBinaryComparator; +import org.apache.jena.hadoop.rdf.types.converters.ThriftConverter; +import org.apache.jena.riot.thrift.TRDF; +import org.apache.jena.riot.thrift.ThriftConvert; +import org.apache.jena.riot.thrift.wire.RDF_Term; +import org.apache.thrift.TException; + +import com.hp.hpl.jena.graph.Node; +import com.hp.hpl.jena.sparql.util.NodeUtils; + +/** + * A writable for {@link Node} instances + * <p> + * This uses <a + * href="http://afs.github.io/rdf-thrift/rdf-binary-thrift.html">RDF Thrift</a> + * for the binary encoding of terms. The in-memory storage for this type is both + * a {@link Node} and a {@link RDF_Term} with lazy conversion between the two + * forms as necessary. + * </p> + */ +public class NodeWritable implements WritableComparable<NodeWritable> { + + static { + WritableComparator.define(NodeWritable.class, new SimpleBinaryComparator()); + } + + private Node node; + private RDF_Term term = new RDF_Term(); + + /** + * Creates an empty writable + */ + public NodeWritable() { + this(null); + } + + /** + * Creates a new instance from the given input + * + * @param input + * Input + * @return New instance + * @throws IOException + */ + public static NodeWritable read(DataInput input) throws IOException { + NodeWritable nw = new NodeWritable(); + nw.readFields(input); + return nw; + } + + /** + * Creates a new writable with the given value + * + * @param n + * Node + */ + public NodeWritable(Node n) { + this.set(n); + } + + /** + * Gets the node + * + * @return Node + */ + public Node get() { + // We may not have yet loaded the node + if (this.node == null) { + // If term is set to undefined then node is supposed to be null + if (this.term.isSet() && !this.term.isSetUndefined()) { + this.node = ThriftConvert.convert(this.term); + } + } + return this.node; + } + + /** + * Sets the node + * + * @param n + * Node + */ + public void set(Node n) { + this.node = n; + // Clear the term for now + // We only convert the Node to a term as and when we want to write it + // out in order to not waste effort if the value is never written out + this.term.clear(); + } + + @Override + public void readFields(DataInput input) throws IOException { + // Clear previous value + this.node = null; + this.term.clear(); + + // Read in the new value + int termLength = input.readInt(); + byte[] buffer = new byte[termLength]; + input.readFully(buffer); + try { + ThriftConverter.fromBytes(buffer, this.term); + } catch (TException e) { + throw new IOException(e); + } + + // Note that we don't convert it back into a Node at this time + } + + @Override + public void write(DataOutput output) throws IOException { + // May not yet have prepared the Thrift term + if (!this.term.isSet()) { + if (this.node == null) { + this.term.setUndefined(TRDF.UNDEF); + } else { + ThriftConvert.toThrift(this.node, null, this.term, false); + } + } + + // Write out the Thrift term + byte[] buffer; + try { + buffer = ThriftConverter.toBytes(this.term); + } catch (TException e) { + throw new IOException(e); + } + output.writeInt(buffer.length); + output.write(buffer); + } + + @Override + public int compareTo(NodeWritable other) { + // Use get() rather than accessing the field directly because the node + // field is lazily instantiated from the Thrift term + return NodeUtils.compareRDFTerms(this.get(), other.get()); + } + + @Override + public String toString() { + // Use get() rather than accessing the field directly because the node + // field is lazily instantiated from the Thrift term + Node n = this.get(); + if (n == null) + return ""; + return n.toString(); + } + + @Override + public int hashCode() { + // Use get() rather than accessing the field directly because the node + // field is lazily instantiated from the Thrift term + Node n = this.get(); + return n != null ? this.get().hashCode() : 0; + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof NodeWritable)) + return false; + return this.compareTo((NodeWritable) other) == 0; + } +}
