Class JsonSerializationProcessor

java.lang.Object
org.wikidata.wdtk.examples.JsonSerializationProcessor
All Implemented Interfaces:
EntityDocumentProcessor

public class JsonSerializationProcessor extends Object implements 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 Details

    • JsonSerializationProcessor

      public JsonSerializationProcessor() throws IOException
      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

      public static void main(String[] args) throws IOException
      Runs the example program.
      Parameters:
      args -
      Throws:
      IOException - if there was a problem in writing the output file
    • processItemDocument

      public void processItemDocument(ItemDocument itemDocument)
      Description copied from interface: EntityDocumentProcessor
      Processes the given ItemDocument.
      Specified by:
      processItemDocument in interface EntityDocumentProcessor
      Parameters:
      itemDocument - the ItemDocument
    • processPropertyDocument

      public void processPropertyDocument(PropertyDocument propertyDocument)
      Description copied from interface: EntityDocumentProcessor
      Processes the given PropertyDocument.
      Specified by:
      processPropertyDocument in interface EntityDocumentProcessor
      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.