Class LabelsAcrossContextNodes

  • All Implemented Interfaces:
    edu.cornell.mannlib.vitro.webapp.searchindex.documentBuilding.DocumentModifier, edu.cornell.mannlib.vitro.webapp.searchindex.indexing.IndexingUriFinder, edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser

    public class LabelsAcrossContextNodes
    extends Object
    implements edu.cornell.mannlib.vitro.webapp.searchindex.indexing.IndexingUriFinder, edu.cornell.mannlib.vitro.webapp.searchindex.documentBuilding.DocumentModifier, edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser
    If an individual has context nodes then the search document for that individual should include the labels of the partners across those nodes. The labels will be added to the ALLTEXT and ALLTEXTUNSTEMMED fields. We must specify what property leads to a context node (incoming), and what property leads from a context node (outgoing). We may add restrictions to say that this only applies to individuals of certain types. We may also restrict the type of the applicable context nodes. An instance of this class acts as both a DocumentModifier and an IndexingUriFinder: As a DocumentModifier, it looks across approved context nodes to fetch the labels of the partners. As an IndexingUriFinder, it recognizes that this relationship can be changed by a change to a "label" statement, or to a "relates" property, and finds all partners as candidates for reindexing.
     Configuration:
         rdfs:label -- Optional. Appears in the timings and debug statements.
         :hasIncomingProperty -- Required. Property leading to the context node.
         :hasOutgoingProperty -- Required. Property leading from the context node.
         :hasTypeRestriction -- Optional. Match any. If none, then no restriction.
         :appliesToContextNodeType -- Optional. Match any. If none, then no restriction.
     
    • Constructor Detail

      • LabelsAcrossContextNodes

        public LabelsAcrossContextNodes()
    • Method Detail

      • setContextModels

        public void setContextModels​(edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccess models)
        Specified by:
        setContextModels in interface edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser
      • setLabel

        public void setLabel​(String l)
      • setIncomingProperty

        public void setIncomingProperty​(String incomingUri)
      • setOutgoingProperty

        public void setOutgoingProperty​(String outgoingUri)
      • addTypeRestriction

        public void addTypeRestriction​(String typeUri)
      • addContextNodeClass

        public void addContextNodeClass​(String cnc)
      • validate

        public void validate()
      • modifyDocument

        public void modifyDocument​(edu.cornell.mannlib.vitro.webapp.beans.Individual ind,
                                   edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument doc)
        If this individual is acceptable, locate the labels of any context partners across acceptable context nodes. Add those labels to the text fields of the search document.
        Specified by:
        modifyDocument in interface edu.cornell.mannlib.vitro.webapp.searchindex.documentBuilding.DocumentModifier
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface edu.cornell.mannlib.vitro.webapp.searchindex.documentBuilding.DocumentModifier
      • startIndexing

        public void startIndexing()
        Specified by:
        startIndexing in interface edu.cornell.mannlib.vitro.webapp.searchindex.indexing.IndexingUriFinder
      • findAdditionalURIsToIndex

        public List<String> findAdditionalURIsToIndex​(org.apache.jena.rdf.model.Statement stmt)
        If this is a "label" statement, check to see if the subject has any acceptable partners across acceptable context nodes. If this is a statement that involves the specified incoming property on an acceptable context node, check to see if there are any acceptable partners on this node.
        Specified by:
        findAdditionalURIsToIndex in interface edu.cornell.mannlib.vitro.webapp.searchindex.indexing.IndexingUriFinder
      • endIndexing

        public void endIndexing()
        Specified by:
        endIndexing in interface edu.cornell.mannlib.vitro.webapp.searchindex.indexing.IndexingUriFinder