1   package eu.fbk.knowledgestore.populator.rdf;
2   
3   import javax.annotation.Nullable;
4   
5   import com.google.common.base.MoreObjects;
6   import com.google.common.base.Preconditions;
7   
8   import org.openrdf.model.Statement;
9   import org.openrdf.model.URI;
10  
11  import eu.fbk.knowledgestore.data.Handler;
12  import eu.fbk.knowledgestore.data.Record;
13  import eu.fbk.knowledgestore.vocabulary.CKR;
14  
15  public class Decoder implements Handler<Statement> {
16  
17      private final Handler<? super Record> axiomHandler; // axioms to be emitted here
18  
19      private final URI globalURI;
20  
21      Decoder(final Handler<? super Record> axiomHandler, @Nullable final URI globalURI) {
22          this.axiomHandler = Preconditions.checkNotNull(axiomHandler);
23          this.globalURI = MoreObjects.firstNonNull(globalURI, CKR.GLOBAL);
24      }
25  
26      @Override
27      public void handle(final Statement element) throws Throwable {
28          // TODO
29          if (element == null) {
30              // end of sequence
31              this.axiomHandler.handle(null);
32          } else {
33              // process it
34          }
35      }
36  
37  }