From: <chr...@us...> - 2012-07-13 09:50:44
|
Revision: 3788 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3788&view=rev Author: christinaunger Date: 2012-07-13 09:50:38 +0000 (Fri, 13 Jul 2012) Log Message: ----------- - again tried to the number problem :P - introduced distinction between equal and equals Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sem/drs/DRS.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java 2012-07-13 08:39:06 UTC (rev 3787) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java 2012-07-13 09:50:38 UTC (rev 3788) @@ -319,7 +319,7 @@ out.addOrderBy(new SPARQL_Term(simple.getArguments().get(0).getValue(), SPARQL_OrderBy.ASC)); out.setLimit(1); return out; - } else if (predicate.equals("equal")) { + } else if (predicate.equals("equals")) { out.addFilter(new SPARQL_Filter( new SPARQL_Pair( new SPARQL_Term(simple.getArguments().get(0).getValue(),false), @@ -347,9 +347,11 @@ out.addCondition(new SPARQL_Triple(term,new SPARQL_Property("type",new SPARQL_Prefix("rdf","")),prop)); } else if (arity == 2) { - String arg1 = simple.getArguments().get(0).getValue();SPARQL_Term term1 = new SPARQL_Term(arg1,false);term1.setIsVariable(true); - String arg2 = simple.getArguments().get(1).getValue();SPARQL_Term term2 = new SPARQL_Term(arg2,false);term2.setIsVariable(true); - out.addCondition(new SPARQL_Triple(term1, prop, term2)); + String arg1 = simple.getArguments().get(0).getValue(); + SPARQL_Term term1 = new SPARQL_Term(arg1,arg1.contains(":"),!arg1.matches("(\\?)?[0-9]+")); + String arg2 = simple.getArguments().get(1).getValue(); + SPARQL_Term term2 = new SPARQL_Term(arg2,arg2.contains(":"),!arg2.matches("(\\?)?[0-9]+")); + out.addCondition(new SPARQL_Triple(term1,prop,term2)); } else if (arity > 2) { // TODO @@ -371,11 +373,11 @@ if (s.getAnchor().equals(v1)) v1isSlotVar = true; if (s.getAnchor().equals(v2)) v2isSlotVar = true; } - if (!v1isSlotVar && !v1.matches("[0..9]+") && !v1.contains("count")) { + if (!v1isSlotVar && !v1.matches("(\\?)?[0-9]+") && !v1.contains("count")) { if (vs.containsKey(v1)) vs.put(v1,vs.get(v1)+1); else vs.put(v1,1); } - if (!v2isSlotVar && !v2.matches("[0..9]+") && !v2.contains("count")) { + if (!v2isSlotVar && !v2.matches("(\\?)?[0-9]+") && !v2.contains("count")) { if (vs.containsKey(v2)) vs.put(v2,vs.get(v2)+1); else vs.put(v2,1); } @@ -402,9 +404,7 @@ Set<Simple_DRS_Condition> equalsConditions = new HashSet<Simple_DRS_Condition>(); for (Simple_DRS_Condition c : drs.getAllSimpleConditions()) { - if(c.getPredicate().equals("equal") - && !c.getArguments().get(0).getValue().matches("[0-9]+") - && !c.getArguments().get(1).getValue().matches("[0-9]+")) + if(c.getPredicate().equals("equal")) equalsConditions.add(c); } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sem/drs/DRS.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sem/drs/DRS.java 2012-07-13 08:39:06 UTC (rev 3787) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sem/drs/DRS.java 2012-07-13 09:50:38 UTC (rev 3788) @@ -312,7 +312,7 @@ next = true; } m_DiscourseReferents.remove(dr2); - if (!isInUpperUniverse) { + if (!isInUpperUniverse && !dr2.m_Referent.matches("[0-9]+")) { m_DiscourseReferents.add(new DiscourseReferent(dr2.m_Referent,marked,nonex)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |