Package org.openrefine.wikidata.editing
Class ReconEntityRewriter
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.DatamodelConverter
org.openrefine.wikidata.editing.ReconEntityRewriter
- All Implemented Interfaces:
org.wikidata.wdtk.datamodel.interfaces.SnakVisitor<org.wikidata.wdtk.datamodel.interfaces.Snak>,org.wikidata.wdtk.datamodel.interfaces.ValueVisitor<org.wikidata.wdtk.datamodel.interfaces.Value>
public class ReconEntityRewriter
extends org.wikidata.wdtk.datamodel.helpers.DatamodelConverter
A class that rewrites an
TermedStatementEntityEdit, replacing reconciled entity id
values by their concrete values after creation of all the new entities involved.
If an entity has not been created yet, an IllegalArgumentException will
be raised.
The subject is treated as a special case: it is returned unchanged. This is
because it is guaranteed not to appear in the update (but it does appear in
the datamodel representation as the subject is passed around to the Claim
objects its document contains).- Author:
- Antonin Delpeuch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classUnchecked version of , for internal use only. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReconEntityRewriter(NewEntityLibrary library, org.wikidata.wdtk.datamodel.interfaces.EntityIdValue subject) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy(StatementEdit value) org.wikidata.wdtk.datamodel.interfaces.ItemIdValuecopy(org.wikidata.wdtk.datamodel.interfaces.ItemIdValue value) org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValuecopy(org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue value) org.wikidata.wdtk.datamodel.interfaces.PropertyIdValuecopy(org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue value) rewrite(EntityEdit edit) Rewrite an edit, replacing references to all entities already created by their fresh identifiers.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.DatamodelConverter
copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copySnak, copyValue, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
-
Field Details
-
notCreatedYetMessage
- See Also:
-
-
Constructor Details
-
ReconEntityRewriter
public ReconEntityRewriter(NewEntityLibrary library, org.wikidata.wdtk.datamodel.interfaces.EntityIdValue subject) Constructor. Sets up a rewriter which uses the provided library to look up ids of new entities.- Parameters:
library- the collection of entities already createdsubject- the subject id of the entity to rewrite
-
-
Method Details
-
copy
public org.wikidata.wdtk.datamodel.interfaces.ItemIdValue copy(org.wikidata.wdtk.datamodel.interfaces.ItemIdValue value) - Overrides:
copyin classorg.wikidata.wdtk.datamodel.helpers.DatamodelConverter
-
copy
public org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue copy(org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue value) - Overrides:
copyin classorg.wikidata.wdtk.datamodel.helpers.DatamodelConverter
-
copy
public org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue copy(org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue value) - Overrides:
copyin classorg.wikidata.wdtk.datamodel.helpers.DatamodelConverter
-
copy
-
rewrite
Rewrite an edit, replacing references to all entities already created by their fresh identifiers. The subject id might not have been created already, in which case it will be left untouched. All the other entities need to have been created already.- Parameters:
edit- the edit to rewrite- Returns:
- the rewritten update
- Throws:
NewEntityNotCreatedYetException- if any non-subject entity had not been created yet
-