From: <lor...@us...> - 2012-07-13 13:21:39
|
Revision: 3790 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3790&view=rev Author: lorenz_b Date: 2012-07-13 13:21:30 +0000 (Fri, 13 Jul 2012) Log Message: ----------- Lowering score for queries with REGEX. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java 2012-07-13 13:20:45 UTC (rev 3789) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java 2012-07-13 13:21:30 UTC (rev 3790) @@ -496,6 +496,7 @@ for(Template t : templates){ logger.info("Processing template:\n" + t.toString()); allocations = new TreeSet<Allocation>(); + boolean containsRegex = t.getQuery().toString().toLowerCase().contains("(regex("); ExecutorService executor = Executors.newFixedThreadPool(t.getSlots().size()); List<Future<Map<Slot, SortedSet<Allocation>>>> list = new ArrayList<Future<Map<Slot, SortedSet<Allocation>>>>(); @@ -701,6 +702,13 @@ } } + //lower queries with FILTER-REGEX + if(containsRegex){ + for(WeightedQuery wQ : tmp){ + wQ.setScore(wQ.getScore() - 0.01); + } + } + queries.clear(); queries.addAll(tmp);//System.out.println(tmp); tmp.clear(); @@ -1134,6 +1142,23 @@ return new TreeSet<Allocation>(allocations); } + private Index getIndexBySlotType(Slot slot){ + Index index = null; + SlotType type = slot.getSlotType(); + if(type == SlotType.CLASS){ + index = classesIndex; + } else if(type == SlotType.PROPERTY || type == SlotType.SYMPROPERTY){ + index = propertiesIndex; + } else if(type == SlotType.DATATYPEPROPERTY){ + index = datatypePropertiesIndex; + } else if(type == SlotType.OBJECTPROPERTY){ + index = objectPropertiesIndex; + } else if(type == SlotType.RESOURCE || type == SlotType.UNSPEC){ + index = resourcesIndex; + } + return index; + } + } public String getTaggedInput(){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |