public String getMetricAdvice(int sessionId) { String metric = ""; logger.info("" + sessionId); LimesUser lu = UserManager.getInstance().getUser(sessionId); System.out.println(lu); KBInfo sourceInfo = createKBInfo(lu.getSourceMap()); KBInfo targetInfo = createKBInfo(lu.getTargetMap()); if (sourceInfo.prefixes == null) sourceInfo.prefixes = new HashMap<String, String>(); if (targetInfo.prefixes == null) targetInfo.prefixes = new HashMap<String, String>(); // sourceInfo.prefixes.put("rdf", PrefixHelper.getURI("rdf")); // sourceInfo.prefixes.put("dbp", PrefixHelper.getURI("dbp")); // sourceInfo.prefixes.put("rdfs", PrefixHelper.getURI("rdfs")); // targetInfo.prefixes.put("rdf", PrefixHelper.getURI("rdf")); // targetInfo.prefixes.put("dbp", PrefixHelper.getURI("dbp")); // targetInfo.prefixes.put("rdfs", PrefixHelper.getURI("rdfs")); logger.info("getMetricAdvice(): Getting caches..."); HybridCache sC = HybridCache.getData(sourceInfo); HybridCache tC = HybridCache.getData(targetInfo); logger.info("getMetricAdvice(): Start SelfConfig..."); MeshBasedSelfConfigurator mbsc = new MeshBasedSelfConfigurator(sC, tC, 0.6, 0.5); List<SimpleClassifier> classifierList = mbsc.getBestInitialClassifiers(); if (classifierList.size() > 0) { classifierList = mbsc.learnClassifer(classifierList); } ComplexClassifier compC = mbsc.getZoomedHillTop(5, 5, classifierList); metric = this.generateMetric(compC.classifiers, "", sourceInfo, targetInfo); lu.setNoUsageTime(0); logger.info("getMetricAdvice(): metric=\n" + metric); return metric; }
public void setMetricSpec(int sessionId, String metricMap) { try { HashMap<String, Object> metricJMap = JsonParser.parseJSONToJava(metricMap); LimesUser lu = UserManager.getInstance().getUser(sessionId); log.info(metricMap); lu.setMetricMap(metricJMap); lu.setNoUsageTime(0); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void setSpecification(int sessionId, String source, String target) { try { HashMap<String, Object> sourceMap = JsonParser.parseJSONToJava(source); HashMap<String, Object> targetMap = JsonParser.parseJSONToJava(target); LimesUser lu = UserManager.getInstance().getUser(sessionId); lu.setSourceMap(sourceMap); lu.setTargetMap(targetMap); lu.setNoUsageTime(0); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void getMapping(int mailAddress) { LimesUser le = UserManager.getInstance().getUser(mailAddress); le.addPropertyChangeListener(UserManager.getInstance()); HashMap<String, Object> source; source = le.getSourceMap(); HashMap<String, Object> target = le.getTargetMap(); HashMap<String, Object> metric = le.getMetricMap(); KBInfo sourceInfo = createKBInfo(source); KBInfo targetInfo = createKBInfo(target); // get metric String metricExpr = (String) metric.get("metric"); Double accThreshold = (Double) metric.get("accthreshold"); Double verThreshold = (Double) metric.get("verthreshold"); le.calculateMapping(sourceInfo, targetInfo, metricExpr, accThreshold, verThreshold); le.setNoUsageTime(0); }
public String fetchMetricMap(int sessionId) { LimesUser lu = UserManager.getInstance().getUser(sessionId); String result = ""; return JsonParser.parseJavaToJSON(lu.getMetricMap()); }
public String fetchTargetData(int sessionId) { LimesUser lu = UserManager.getInstance().getUser(sessionId); return JsonParser.parseJavaToJSON(lu.getTargetMap()); }