SHARE
TWEET

Untitled

a guest Oct 21st, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class TextDocProducerTriplesFK extends TextDocProducerTriples {
  2.  
  3.   final DatasetGraph dg;
  4.   private final EntityDefinition defn ;
  5.  
  6.   public TextDocProducerTriplesFK(DatasetGraph dg, TextIndex indexer) {
  7.     super(indexer);
  8.     this.defn = indexer.getDocDef() ;
  9.     this.dg = dg;
  10.   }
  11.  
  12.   public void change(QuadAction qaction, Node g, Node s, Node p, Node o) {
  13.     Entity entity = TextQueryFuncs.entityFromQuad(defn, g, s, p, o) ;
  14.     if ((qaction == QuadAction.ADD || qaction == QuadAction.DELETE) && isIndexable(entity)) {
  15.       super.change(qaction, g, s, p, o);
  16.     }
  17.   }
  18.  
  19.   public static boolean isIndexable(Entity entity) {
  20.     if (entity != null) {
  21.       String id = entity.getId();
  22.       String[] subSplit = id.split("/");
  23.       //Don't index PID version of facts
  24.       if ((id.contains(TABLES_NODE_IDENTIFIER)) && subSplit[subSplit.length-1].matches("[0-9]+")) {
  25.         return false;
  26.       }
  27.       //Only indexing tables, reports and ingestionObjects for now
  28.       return id.contains(TABLES_NODE_IDENTIFIER) || id.contains(REPORTS_NODE_IDENTIFIER) ||
  29.           id.contains(INGESTION_OBJ_NODE_IDENTIFIER);
  30.     }
  31.     return false;
  32.   }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top