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
DatamodelFilter
to 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the output.static void
Runs the example program.static void
Prints some basic documentation about this program.void
processItemDocument
(ItemDocument itemDocument) Processes the given ItemDocument.void
processPropertyDocument
(PropertyDocument propertyDocument) Processes the given PropertyDocument.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:EntityDocumentProcessor
Processes the given ItemDocument.- Specified by:
processItemDocument
in interfaceEntityDocumentProcessor
- Parameters:
itemDocument
- the ItemDocument
-
processPropertyDocument
Description copied from interface:EntityDocumentProcessor
Processes the given PropertyDocument.- Specified by:
processPropertyDocument
in 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.
-