Concept "Compiling Dataspects::Entity annotations"

From SMW CindyKate - Main
Component1272249423
Jump to: navigation, search
For an entity that will end up as a document in an Elasticsearch index, annotations are compiled across various stages.

Content


Stage "myIndexingJob.rb"

Within hEntityDoc

Just before compiling hEntityDoc

These annotations will be :set_by_myIndexingJob.

# This is in file myIndexingJob.rb.
oFacet... do |oResource|
  oResource.aEntities.each do |oEntity|
    oEntity.set_annotation(oEntity.sHasEntityName, 'predicate', 'object/value')
    ...
  end
end

By overwriting Dataspects::SemanticMediaWikiPage.aEntities or Dataspects::Resource.aEntities respectively

Notice:

Dataspects::SemanticMediaWikiPage is an example of a Dataspects::Resource subclass.

These annotations will be :set_by_myIndexingJob.

# This is in file myIndexingJob.rb.
module Dataspects
  class SemanticMediaWikiPage
    def aEntities
      ...
      oEntity.set_annotation(oEntity.sHasEntityName, 'predicate', 'object/value')
      ...
    end
  end
end

Stage "Dataspects::Entity subclass"

All these annotations will be e.g. :set_by_Dataspects_Subject_Class.

Stage "Dataspects::Entity"

All these annotations will be :set_by_Dataspects_Entity_Class.

  • .initialize(oResource) will populate all DSKMF standard entity annotations with default values set by the corresponding resource.
  • .get_aHasEntityAnnotations() collects entity annotations that shall be stored in hEntityDoc = { HasEntityAnnotations: oEntity.get_aHasEntityAnnotations }. It allows for skipping entity annotations by registering them in aSkipThesePredicates (usually all DSKMF standard entity annotations).

Stage "Dataspects::Resource subclass"

All these annotations will be e.g. set_by_Dataspects_SemanticMediaWikiPage_Class.