DumpProcessingAction, org.wikidata.wdtk.datamodel.interfaces.EntityDocumentDumpProcessor, org.wikidata.wdtk.datamodel.interfaces.EntityDocumentProcessorpublic class SchemaUsageAnalyzer extends java.lang.Object implements DumpProcessingAction
| Modifier and Type | Field | Description |
|---|---|---|
protected java.lang.String |
dateStamp |
|
protected static com.fasterxml.jackson.databind.ObjectMapper |
mapper |
Object mapper that is used to serialize JSON.
|
protected java.lang.String |
name |
Name as an action, if any
|
protected java.lang.String |
project |
|
protected java.nio.file.Path |
resultDirectory |
The place where result files will be stored.
|
protected org.wikidata.wdtk.datamodel.interfaces.Sites |
sites |
Sites information used to extract site data.
|
| Constructor | Description |
|---|---|
SchemaUsageAnalyzer() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
protected void |
countTerms(org.wikidata.wdtk.datamodel.interfaces.TermedDocument termedDocument,
org.wikidata.wdtk.client.SchemaUsageAnalyzer.EntityStatistics entityStatistics) |
Count the terms (labels, descriptions, aliases) of an item or property
document.
|
java.lang.String |
getActionName() |
Returns the name of the action.
|
java.lang.String |
getDefaultActionName() |
Returns the default name for an action.
|
java.lang.String |
getReport() |
Returns a report message containing information about the files which
were generated.
|
boolean |
isReady() |
Returns true if the action is ready to process a dump.
|
boolean |
needsSites() |
Returns true if processing requires a
Sites object to be set. |
void |
open() |
|
static java.io.FileOutputStream |
openResultFileOuputStream(java.nio.file.Path resultDirectory,
java.lang.String filename) |
Opens a new FileOutputStream for a file of the given name in the given
result directory.
|
void |
processItemDocument(org.wikidata.wdtk.datamodel.interfaces.ItemDocument itemDocument) |
|
void |
processPropertyDocument(org.wikidata.wdtk.datamodel.interfaces.PropertyDocument propertyDocument) |
|
void |
setActionName(java.lang.String name) |
Sets the name of the action.
|
void |
setDumpInformation(java.lang.String project,
java.lang.String dateStamp) |
Provides the action with general information about the dump that is to be
processed.
|
boolean |
setOption(java.lang.String option,
java.lang.String value) |
Sets the options of the specified name to the given value.
|
void |
setSites(org.wikidata.wdtk.datamodel.interfaces.Sites sites) |
Sets the sites information to the given value.
|
boolean |
useStdOut() |
Returns true if this action will write results (not log messages) to
stdout.
|
void |
writeStatisticsData(java.io.PrintStream out) |
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
protected java.nio.file.Path resultDirectory
protected org.wikidata.wdtk.datamodel.interfaces.Sites sites
protected java.lang.String name
protected java.lang.String dateStamp
protected java.lang.String project
public static java.io.FileOutputStream openResultFileOuputStream(java.nio.file.Path resultDirectory,
java.lang.String filename)
throws java.io.IOException
resultDirectory - the path to the result directoryfilename - the name of the file to write tojava.io.IOException - if the file or example output directory could not be createdpublic void processItemDocument(org.wikidata.wdtk.datamodel.interfaces.ItemDocument itemDocument)
processItemDocument in interface org.wikidata.wdtk.datamodel.interfaces.EntityDocumentProcessorpublic void processPropertyDocument(org.wikidata.wdtk.datamodel.interfaces.PropertyDocument propertyDocument)
processPropertyDocument in interface org.wikidata.wdtk.datamodel.interfaces.EntityDocumentProcessorprotected void countTerms(org.wikidata.wdtk.datamodel.interfaces.TermedDocument termedDocument,
org.wikidata.wdtk.client.SchemaUsageAnalyzer.EntityStatistics entityStatistics)
termedDocument - document to count the terms ofentityStatistics - record where statistics are countedpublic void writeStatisticsData(java.io.PrintStream out)
throws com.fasterxml.jackson.core.JsonGenerationException,
com.fasterxml.jackson.databind.JsonMappingException,
java.io.IOException
com.fasterxml.jackson.core.JsonGenerationExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionjava.io.IOExceptionpublic boolean needsSites()
DumpProcessingActionSites object to be set.
This is the case for some operations that process site links.needsSites in interface DumpProcessingActionpublic boolean isReady()
DumpProcessingActionIf this method is called on an action that is not ready, the action should print helpful information on the missing configuration to stdout as a side effect.
isReady in interface DumpProcessingActionpublic java.lang.String getReport()
DumpProcessingActiongetReport in interface DumpProcessingActionpublic void open()
open in interface org.wikidata.wdtk.datamodel.interfaces.EntityDocumentDumpProcessorpublic void close()
close in interface org.wikidata.wdtk.datamodel.interfaces.EntityDocumentDumpProcessorpublic void setSites(org.wikidata.wdtk.datamodel.interfaces.Sites sites)
DumpProcessingActionDumpProcessingAction.needsSites() is used to find out if this is actually needed.setSites in interface DumpProcessingActionsites - the sites information for the data that will be processedpublic boolean setOption(java.lang.String option,
java.lang.String value)
DumpProcessingActionsetOption in interface DumpProcessingActionoption - name of the option to be setvalue - the new value of the optionpublic boolean useStdOut()
DumpProcessingActionuseStdOut in interface DumpProcessingActionpublic void setDumpInformation(java.lang.String project,
java.lang.String dateStamp)
DumpProcessingActionsetDumpInformation in interface DumpProcessingActionproject - the name of the project that the dump is fromdateStamp - the datestamp (YYYYMMDD) for the dumppublic void setActionName(java.lang.String name)
DumpProcessingActionsetActionName in interface DumpProcessingActionpublic java.lang.String getActionName()
DumpProcessingActiongetActionName in interface DumpProcessingActionpublic java.lang.String getDefaultActionName()
DumpProcessingActiongetDefaultActionName in interface DumpProcessingActionCopyright © 2014–2017 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage