package uk.ac.abdn.foodsafety.provenance;

import java.util.Observable;

import uk.ac.abdn.foodsafety.common.Logging;
import eu.larkc.csparql.common.RDFTable;
import eu.larkc.csparql.core.ResultFormatter;

class FoodSafetyFormatter extends ResultFormatter {
    private final String queryName;

    FoodSafetyFormatter(final String queryName) {
        this.queryName = queryName;
    }
    
    /**
     * Called when C-Sparql emits a window.
     */
    @Override
    public void update(final Observable ignored, final Object rdfTableUntyped) {
        final RDFTable rdfTable = (RDFTable) rdfTableUntyped;
        Logging.info(String.format("Query %s emitted %d triples", this.queryName, rdfTable.size()));
    }

    public void addSparql(final String name, final String content) {
        // TODO Auto-generated method stub
        
    }

    public void setOwl(final String content) {
        // TODO Auto-generated method stub
        
    }   
}
@@ -32,24 +32,101 @@
 rovenance;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.EnumMap;%0Aimport java.util.List;%0A
 import java.
@@ -336,126 +336,487 @@
     
-private final String queryName;%0A%0A    FoodSafetyFormatter(final String queryName) %7B%0A        this.queryName = queryName;
+/** Name picked up from directory - used for logging */%0A    private final String queryName;%0A    %0A    private EnumMap%3CStage, List%3CString%3E%3E sparqlUpdateQueries =%0A            new EnumMap%3CStage, List%3CString%3E%3E(Stage.class);%0A%0A    FoodSafetyFormatter(final String queryName) %7B%0A        this.queryName = queryName;%0A        //Initialize SPARQL update query collections%0A        for (Stage s : Stage.values()) %7B%0A            this.sparqlUpdateQueries.put(s, new ArrayList%3CString%3E());%0A        %7D
 %0A   
@@ -1229,51 +1229,85 @@
     
-// TODO Auto-generated method stub%0A        
+this.sparqlUpdateQueries.get(Stage.valueOf(name.toUpperCase())).add(content);
 %0A   
@@ -1414,13 +1414,76 @@
   %0A    %7D
+%0A
    
+ %0A    private enum Stage %7B%0A      COLDSTART,%0A      WARM;%0A    %7D;
 %0A%7D

Store the SPARQL update queries