Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TextDocProducerTriplesFK extends TextDocProducerTriples {
- final DatasetGraph dg;
- private final EntityDefinition defn ;
- public TextDocProducerTriplesFK(DatasetGraph dg, TextIndex indexer) {
- super(indexer);
- this.defn = indexer.getDocDef() ;
- this.dg = dg;
- }
- public void change(QuadAction qaction, Node g, Node s, Node p, Node o) {
- Entity entity = TextQueryFuncs.entityFromQuad(defn, g, s, p, o) ;
- if ((qaction == QuadAction.ADD || qaction == QuadAction.DELETE) && isIndexable(entity)) {
- super.change(qaction, g, s, p, o);
- }
- }
- public static boolean isIndexable(Entity entity) {
- if (entity != null) {
- String id = entity.getId();
- String[] subSplit = id.split("/");
- //Don't index PID version of facts
- if ((id.contains(TABLES_NODE_IDENTIFIER)) && subSplit[subSplit.length-1].matches("[0-9]+")) {
- return false;
- }
- //Only indexing tables, reports and ingestionObjects for now
- return id.contains(TABLES_NODE_IDENTIFIER) || id.contains(REPORTS_NODE_IDENTIFIER) ||
- id.contains(INGESTION_OBJ_NODE_IDENTIFIER);
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement