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 Classes
    Modifier and Type
    Class
    Description
    protected static class 
    Unchecked version of , for internal use only.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReconEntityRewriter(NewEntityLibrary library, org.wikidata.wdtk.datamodel.interfaces.EntityIdValue subject)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    org.wikidata.wdtk.datamodel.interfaces.ItemIdValue
    copy(org.wikidata.wdtk.datamodel.interfaces.ItemIdValue value)
     
    org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue
    copy(org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue value)
     
    org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue
    copy(org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue value)
     
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 created
      subject - 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:
      copy in class org.wikidata.wdtk.datamodel.helpers.DatamodelConverter
    • copy

      public org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue copy(org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue value)
      Overrides:
      copy in class org.wikidata.wdtk.datamodel.helpers.DatamodelConverter
    • copy

      public org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue copy(org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue value)
      Overrides:
      copy in class org.wikidata.wdtk.datamodel.helpers.DatamodelConverter
    • copy

      public StatementEdit copy(StatementEdit value)
    • 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