Package org.wikidata.wdtk.examples
Class JsonSerializationProcessor
java.lang.Object
org.wikidata.wdtk.examples.JsonSerializationProcessor
- All Implemented Interfaces:
EntityDocumentProcessor
This example illustrates how to create a JSON serialization of some of the
data found in a dump. It uses a
DatamodelFilterto eliminate some of the data.
As an example, the program only serializes data for people who were born in
Dresden, Germany. This can be changed by modifying the code in
includeDocument(ItemDocument).
- Author:
- Markus Kroetzsch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the output.static voidRuns the example program.static voidPrints some basic documentation about this program.voidprocessItemDocument(ItemDocument itemDocument) Processes the given ItemDocument.voidprocessPropertyDocument(PropertyDocument propertyDocument) Processes the given PropertyDocument.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.EntityDocumentProcessor
processEntityRedirectDocument, processLexemeDocument, processMediaInfoDocument
-
Constructor Details
-
JsonSerializationProcessor
Constructor. Initializes various helper objects we use for the JSON serialization, and opens the file that we want to write to.- Throws:
IOException- if there is a problem opening the output file
-
-
Method Details
-
main
Runs the example program.- Parameters:
args-- Throws:
IOException- if there was a problem in writing the output file
-
processItemDocument
Description copied from interface:EntityDocumentProcessorProcesses the given ItemDocument.- Specified by:
processItemDocumentin interfaceEntityDocumentProcessor- Parameters:
itemDocument- the ItemDocument
-
processPropertyDocument
Description copied from interface:EntityDocumentProcessorProcesses the given PropertyDocument.- Specified by:
processPropertyDocumentin interfaceEntityDocumentProcessor- Parameters:
propertyDocument- the PropertyDocument
-
printDocumentation
public static void printDocumentation()Prints some basic documentation about this program. -
close
public void close()Closes the output. Should be called after the JSON serialization was finished.
-