From: <seb...@us...> - 2012-03-15 11:10:48
|
Revision: 3614 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3614&view=rev Author: sebastianwtr Date: 2012-03-15 11:10:37 +0000 (Thu, 15 Mar 2012) Log Message: ----------- [tbsl exploration] removed error in generating templates Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/TemplateBuilder.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/TemplateBuilder.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/TemplateBuilder.java 2012-03-15 03:22:33 UTC (rev 3613) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/TemplateBuilder.java 2012-03-15 11:10:37 UTC (rev 3614) @@ -172,26 +172,40 @@ String tmp= slot.toString().replace(" UNSPEC {", ""); tmp=tmp.replace("}",""); String[] tmp_array = tmp.split(":"); + boolean no_iaA_found=true; for(ArrayList<String> x : condition){ if(x.get(1).equals("isA") && x.get(2).equals("?"+tmp_array[0])){ + no_iaA_found=false; Hypothesis tmp_hypothesis = new Hypothesis("?"+tmp_array[0],tmp_array[1], tmp_array[1], "ISA", 0); //tmp_hypothesis.printAll(); list_of_hypothesis.add(tmp_hypothesis); /* - * if you have already found an isA -Class-Pair, you dont have to creat the up-side-down, because it will be false + * if you have already found an isA -Class-Pair, you don't have to create the up-side-down, because it will be false */ add_reverse_template = false; } /* - * Make sure you dont have the case that a class is left of an isA + * Make sure you don't have the case that a class is left of an isA */ - else if (!x.get(1).equals("isA") && x.get(0).equals("?"+tmp_array[0])){ - Hypothesis tmp_hypothesis = new Hypothesis("?"+tmp_array[0],tmp_array[1], tmp_array[1], "UNSPEC", 0); + /*else if (!x.get(1).equals("isA") && x.get(0).equals("?"+tmp_array[0])){ + Hypothesis tmp_hypothesis = new Hypothesis("?"+tmp_array[0],tmp_array[1], tmp_array[1], "PROPERTY", 0); + //tmp_hypothesis.printAll(); + list_of_hypothesis.add(tmp_hypothesis); + } + else if(!x.get(1).equals("isA") && x.get(2).equals("?"+tmp_array[0]) ){ + Hypothesis tmp_hypothesis = new Hypothesis("?"+tmp_array[0],tmp_array[1], tmp_array[1], "PROPERTY", 0); //tmp_hypothesis.printAll(); list_of_hypothesis.add(tmp_hypothesis); - } + }*/ } + + if(no_iaA_found){ + Hypothesis tmp_hypothesis = new Hypothesis("?"+tmp_array[0],tmp_array[1], tmp_array[1], "PROPERTY", 0); + //tmp_hypothesis.printAll(); + list_of_hypothesis.add(tmp_hypothesis); + } + } if(slot.toString().contains("PROPERTY")){ String tmp= slot.toString().replace(" PROPERTY {", ""); @@ -212,7 +226,13 @@ ArrayList<ArrayList<Hypothesis>> final_list_set_hypothesis = new ArrayList<ArrayList<Hypothesis>>(); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + /*System.out.println("Alle Hypothesen VOR der Verarbeitung"); for(Hypothesis x : list_of_hypothesis){ + x.printAll(); + } + System.out.println("Alle Hypothesen VOR der Verarbeitung - Done \n\n"); + */ + for(Hypothesis x : list_of_hypothesis){ /* * TODO: Change if ISA only ask classes, else resource */ @@ -268,9 +288,11 @@ for(Hypothesis h : x){ + //only if you have a Property or an Unspec, which still has no http:/dbpedia etc - if(h.getType().contains("PROPERTY") || (h.getType().contains("UNSPEC")&& !h.getUri().contains("http"))){ + //if(h.getType().contains("PROPERTY") || (h.getType().contains("UNSPEC")&& !h.getUri().contains("http"))){ + if(h.getType().contains("PROPERTY")){ ArrayList<String> result= new ArrayList<String>(); try { if(hm.containsKey(h.getUri().toLowerCase())){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |