Package org.wikidata.wdtk.rdf
Class RdfSerializer
java.lang.Object
org.wikidata.wdtk.rdf.RdfSerializer
- All Implemented Interfaces:
EntityDocumentDumpProcessor
,EntityDocumentProcessor
This class implements
EntityDocumentDumpProcessor
to provide a RDF
serializer to render RDF graphs of EntityDocument
objects.- Author:
- Michael Günther
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionRdfSerializer
(org.eclipse.rdf4j.rio.RDFFormat format, OutputStream output, Sites sites, PropertyRegister propertyRegister) Creates a new RDF serializer for the specified format and output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Finishes the processing by performing any final steps, such as closing resources.int
getTasks()
Returns the tasks that should be performed during export.long
Returns the number of triples that have been written so far.void
open()
Starts the processing by performing any initial steps to prepare processing.void
processItemDocument
(ItemDocument itemDocument) Processes the given ItemDocument.void
processPropertyDocument
(PropertyDocument propertyDocument) Processes the given PropertyDocument.void
setTasks
(int tasks) Sets the tasks that should be performed during export.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
-
Field Details
-
TASK_STATEMENTS
public static final int TASK_STATEMENTS- See Also:
-
TASK_SITELINKS
public static final int TASK_SITELINKS- See Also:
-
TASK_DATATYPES
public static final int TASK_DATATYPES- See Also:
-
TASK_PROPERTY_LINKS
public static final int TASK_PROPERTY_LINKS- See Also:
-
TASK_LABELS
public static final int TASK_LABELS- See Also:
-
TASK_DESCRIPTIONS
public static final int TASK_DESCRIPTIONS- See Also:
-
TASK_ALIASES
public static final int TASK_ALIASES- See Also:
-
TASK_TERMS
public static final int TASK_TERMS- See Also:
-
TASK_ALL_EXACT_DATA
public static final int TASK_ALL_EXACT_DATA- See Also:
-
TASK_SIMPLE_STATEMENTS
public static final int TASK_SIMPLE_STATEMENTS- See Also:
-
TASK_ITEMS
public static final int TASK_ITEMS- See Also:
-
TASK_PROPERTIES
public static final int TASK_PROPERTIES- See Also:
-
TASK_ALL_ENTITIES
public static final int TASK_ALL_ENTITIES- See Also:
-
-
Constructor Details
-
RdfSerializer
public RdfSerializer(org.eclipse.rdf4j.rio.RDFFormat format, OutputStream output, Sites sites, PropertyRegister propertyRegister) Creates a new RDF serializer for the specified format and output stream.- Parameters:
format
- RDF format, such as RDFFormat.TURTLEoutput
- the output stream to write tosites
- information about site links
-
-
Method Details
-
setTasks
public void setTasks(int tasks) Sets the tasks that should be performed during export. The value should be a combination of flags such asTASK_STATEMENTS
.- Parameters:
tasks
- the tasks to be performed
-
getTasks
public int getTasks()Returns the tasks that should be performed during export. The value should be a combination of flags such asTASK_STATEMENTS
.- Returns:
- tasks to be performed
-
getTripleCount
public long getTripleCount()Returns the number of triples that have been written so far.- Returns:
- number of triples
-
open
public void open()Description copied from interface:EntityDocumentDumpProcessor
Starts the processing by performing any initial steps to prepare processing.- Specified by:
open
in interfaceEntityDocumentDumpProcessor
-
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
-
close
public void close()Description copied from interface:EntityDocumentDumpProcessor
Finishes the processing by performing any final steps, such as closing resources.- Specified by:
close
in interfaceEntityDocumentDumpProcessor
-