You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <jen...@us...> - 2009-06-02 14:27:11
|
Revision: 1783 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1783&view=rev Author: jenslehmann Date: 2009-06-02 14:27:09 +0000 (Tue, 02 Jun 2009) Log Message: ----------- suggestion test Modified Paths: -------------- trunk/src/php-examples/Suggestions.php trunk/src/php-examples/Utilities.php Modified: trunk/src/php-examples/Suggestions.php =================================================================== --- trunk/src/php-examples/Suggestions.php 2009-05-29 15:44:38 UTC (rev 1782) +++ trunk/src/php-examples/Suggestions.php 2009-06-02 14:27:09 UTC (rev 1783) @@ -1,11 +1,12 @@ <?php -include('Utilities.php'); - // load WSDL files (has to be done due to a Java web service bug) ini_set("soap.wsdl_cache_enabled","0"); -$wsdluri="http://localhost:8181/services?wsdl"; -Utilities::loadWSDLfiles($wsdluri); +$wsdluri="http://127.0.0.1:8181/services?wsdl"; +if(!file_exists('main.wsdl')) { + include('Utilities.php'); + Utilities::loadWSDLfiles($wsdluri); +} $examples = array('http://dbpedia.org/resource/Leipzig', 'http://dbpedia.org/resource/Dresden'); @@ -15,14 +16,17 @@ $ksID=$client->addKnowledgeSource($id,"sparql","http://dbpedia.org/sparql"); $client->applyConfigEntryInt($id, $ksID, "recursionDepth", 1); -$relatedInstances = $client->getNegativeExamples($id,$ksID,$examples,count($examples),"http://dbpedia.org/resource/",array()); -$instances = array_merge($examples, $relatedInstances->item); +$filterClasses=array("http://xmlns.com/foaf/","http://dbpedia.org/class/yago/","http://dbpedia.org/ontology/Resource"); +// $relatedInstances = $client->getNegativeExamples($id,$ksID,$examples,count($examples),"http://dbpedia.org/resource/",$filterClasses); +// $relatedInstances = $relatedInstances->item; +$relatedInstances = array('http://dbpedia.org/resource/Berlin','http://dbpedia.org/resource/London'); +$instances = array_merge($examples, $relatedInstances); $client->applyConfigEntryStringArray($id, $ksID, "instances", $instances); +// $client->applyConfigEntryString($id, $ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); +$client->applyConfigEntryString($id, $ksID, "predefinedEndpoint", "LOCALDBPEDIA"); +$client->applyConfigEntryString($id, $ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); +$client->applyConfigEntryBoolean($id, $ksID, "saveExtractedFragment", true); -// $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); -// $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", $this->endpoint); -// $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); - $rID = $client->setReasoner($id, "fastInstanceChecker"); $client->setLearningProblem($id, "posOnlyLP"); @@ -32,8 +36,26 @@ $client->initAll($id); +echo '<p>Positive examples:<br />'; +foreach($examples as $example) { + echo $example.'<br />'; +} +echo '</p>'; + +echo '<p>Additional instances:<br />'; +foreach($relatedinstances as $related) { + echo $related.'<br />'; +} +echo '</p>'; + echo 'start learning ... '; -$concept = $client->learnDescriptionsEvaluated($id, 5); +$concepts = $client->learnDescriptionsEvaluated($id, 5); echo 'OK <br />'; +$concepts = json_decode($concepts); + +foreach($concepts as $concept) { + echo $concept; +} + ?> Modified: trunk/src/php-examples/Utilities.php =================================================================== --- trunk/src/php-examples/Utilities.php 2009-05-29 15:44:38 UTC (rev 1782) +++ trunk/src/php-examples/Utilities.php 2009-06-02 14:27:09 UTC (rev 1783) @@ -37,7 +37,9 @@ */ public static function loadWSDLfiles($wsdluri) { $main = self :: getRequest($wsdluri); +// echo "loaded"; $other = self :: getXSDImports($main); +// print_r($other); $newMain = self :: changeXSDImports($main); self :: writeToFile("main.wsdl", $newMain); $x = 0; @@ -71,6 +73,10 @@ * Extracts XSD imports from WSDL file. */ public static function getXSDImports($wsdlFileContent) { + /* + preg_match_all('/\"[^\"\?]*?\?xsd=[^\"]*?\"/',$wsdlFileContent, $matches); + return $matches; + */ $before = "<xsd:import schemaLocation=\""; $after = "\" namespace=\""; $ret = array (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-29 15:44:52
|
Revision: 1782 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1782&view=rev Author: jenslehmann Date: 2009-05-29 15:44:38 +0000 (Fri, 29 May 2009) Log Message: ----------- matching adjustments and small bug fix Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-29 15:22:25 UTC (rev 1781) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-29 15:44:38 UTC (rev 1782) @@ -135,6 +135,8 @@ DBpediaPoint dp = new DBpediaPoint(uri, label, classes, geoLat, geoLong, decimalCount); POIClass poiClass = dp.getPoiClass(); +// System.out.println("DBpedia Point: " + dp); + if(poiClass != null) { // find match (we assume there is exactly one match) URI matchURI = findGeoDataMatch(dp); @@ -165,7 +167,13 @@ switch(itemCount) { case 0 : uri = URI.create(line); break; case 1 : label = line; break; - case 2 : classes = line.substring(1, line.length()).split(","); break; + case 2 : line = line.substring(1, line.length()-1); // strip brackets + if(line.length()>1) { + classes = line.split(","); + } else { + classes = new String[0]; + } + break; case 3 : geoLat = new Double(line); // we avoid "computerized scientific notation" e.g. 9.722222457639873E-4 @@ -398,7 +406,7 @@ // (if there is a way, there should also be a point but not vice versa) // => according to OSM data model, ways do not have longitude/latitude, so we should // always match nodes and not ways (TODO: discuss with Soeren) - queryStr += "FILTER (?point LIKE <http://linkedgeodata.org/triplify/node/%>) ."; +// queryStr += "FILTER (?point LIKE <http://linkedgeodata.org/triplify/node/%>) ."; queryStr += "}"; // SparqlQuery query = new SparqlQuery(queryStr, geoDataEndpoint); @@ -453,9 +461,9 @@ double score = 0.8 * stringSimilarity + 0.2 * distanceScore; // if there is a node and a way, we prefer the node (better representative) -// if(lgdURI.contains("/way/")) { -// score -= 0.02; -// } + if(lgdURI.contains("/way/")) { + score -= 0.02; + } if(score > highestScore) { highestScore = score; Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-29 15:22:25 UTC (rev 1781) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-29 15:44:38 UTC (rev 1782) @@ -140,7 +140,7 @@ @Override public String toString() { - String str = uri + ", \"" + label + "\", " + geoLat + ", " + geoLong + " (classes: "; + String str = uri + ", \"" + label + "\", " + geoLat + ", " + geoLong + " (" + classes.length + " classes: "; for(String clazz : classes) { str += clazz + " "; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2009-05-29 15:22:34
|
Revision: 1781 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1781&view=rev Author: kurzum Date: 2009-05-29 15:22:25 +0000 (Fri, 29 May 2009) Log Message: ----------- classes to produce fragment ontology with all strings in lgd converted to classes Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java trunk/src/dl-learner/org/dllearner/scripts/matching/Stanley.java Added: trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java 2009-05-29 15:22:25 UTC (rev 1781) @@ -0,0 +1,123 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.manipulator; + +import java.net.URLEncoder; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.kb.extraction.Node; +import org.dllearner.utilities.JamonMonitorLogger; +import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; + +import com.hp.hpl.jena.rdf.model.Literal; +import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; + +public class AddAllStringsAsClasses extends Rule{ + String namespace; + + + /** + * @param month + * @param resourceNamespace ns for the created uris + * @param limit does not convert strings that are longer than a specific value, zero means convert all + */ + public AddAllStringsAsClasses(Months month, String resourceNamespace) { + super(month); + String slash = ""; + if(!resourceNamespace.endsWith("/")) { + slash="/"; + } + + this.namespace = resourceNamespace+slash; + + } + + + @Override + public SortedSet<RDFNodeTuple> applyRule(Node subject, SortedSet<RDFNodeTuple> tuples){ + SortedSet<RDFNodeTuple> keep = new TreeSet<RDFNodeTuple>(); + for (RDFNodeTuple tuple : tuples) { + //System.out.println(tuple); + //System.exit(0); + if(tuple.b.isURIResource()){ + //System.out.println("added"); + keep.add(tuple); + continue; + } + + //RDFNode b = null; + if(!tuple.b.isURIResource()){ + boolean replace = true; + + //check for numbers + if(((Literal) tuple.b).getDatatypeURI()!= null){ + replace = false; + } + + //if string is an uri + if(tuple.b.toString().startsWith("http://")){ + //System.out.println(tuple.b.toString()); + if( tuple.b.toString().startsWith("http://ru.wikipedia.org/wiki/СеÑ") || + tuple.bPartContains(" ") + ){ + //filter + continue; + } + + tuple.b = new ResourceImpl(tuple.b.toString()); + replace = false; + } + + + if (replace){ + + String tmp = tuple.b.toString(); + //System.out.println("replaced: "+tmp); + try{ + //encode + tmp = URLEncoder.encode(tmp, "UTF-8"); + }catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } + tmp = namespace+tmp; + tmp = tmp.replaceAll("%", "_"); + keep.add(new RDFNodeTuple(new ResourceImpl(OWLVocabulary.RDF_TYPE),new ResourceImpl(tmp))); + + }else { + // do nothing + }//end else + + }//end if + keep.add(tuple); + } + return keep; + } + + @Override + public void logJamon(){ + JamonMonitorLogger.increaseCount(AddAllStringsAsClasses.class, "replacedObjects"); + } + + + +} Added: trunk/src/dl-learner/org/dllearner/scripts/matching/Stanley.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Stanley.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Stanley.java 2009-05-29 15:22:25 UTC (rev 1781) @@ -0,0 +1,155 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.scripts.matching; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.Map.Entry; +import java.util.zip.DataFormatException; + +import org.dllearner.algorithms.celoe.CELOE; +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.kb.manipulator.AddAllStringsAsClasses; +import org.dllearner.kb.manipulator.Manipulator; +import org.dllearner.kb.manipulator.Rule.Months; +import org.dllearner.kb.sparql.Cache; +import org.dllearner.kb.sparql.SPARQLTasks; +import org.dllearner.kb.sparql.SparqlEndpoint; +import org.dllearner.kb.sparql.SparqlKnowledgeSource; +import org.dllearner.learningproblems.PosOnlyLP; +import org.dllearner.reasoning.FastInstanceChecker; + +/** + * This class produces a fragment for dbpedia and linkedgeodata + * for lgd all strings are converted to classes + * + */ +@SuppressWarnings("unused") +public class Stanley { + + private static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointLOCALDBpedia(); +// private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); + + public static void main(String args[]) throws IOException, DataFormatException, LearningProblemUnsupportedException, ComponentInitException { + File matchesFile = new File("log/geodata/owlsameas_en.dat"); + Map<URI,URI> matches = Utility.getMatches(matchesFile); + + //SPARQLTasks dbpedia = new SPARQLTasks(new Cache("matching"),dbpediaEndpoint); + Set<String> positives = new TreeSet<String>(); + Set<String> negatives = new TreeSet<String>(); + + // loop through all matches + for(Entry<URI,URI> match : matches.entrySet()) { + URI dbpediaURI = match.getKey(); + + URI lgdURI = match.getValue(); + // test whether the dbpediaURI is a city +// String query = "ASK {<"+dbpediaURI+"> a <http://dbpedia.org/ontology/City>}"; + //String query = "ASK {<"+dbpediaURI+"> a <http://dbpedia.org/ontology/Organisation>}"; + //boolean isInClass = dbpedia.ask(query); +// if(!isCity) { +// // DBpedia ontology does not capture all cities, so we also use UMBEL, YAGO +// String query2 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%City%>) }"; +// String query3 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%Cities%>) }"; +// isCity = dbpedia.ask(query2) || dbpedia.ask(query3); +// } +// System.out.println(isCity + " " + lgdURI); +// if(isInClass) { +// +// System.out.println("+\""+lgdURI+"\""); +// } else { +// negatives.add(lgdURI.toString()); +// System.out.println("-\""+lgdURI+"\""); +// } + //System.out.println(lgdURI.toString()); + positives.add(lgdURI.toString()); + } + //System.exit(0); + Set<String> instances = new TreeSet<String>(); + instances.addAll(positives); + instances.addAll(negatives); + + System.out.println(instances.size() + " instances - " + positives.size() + " positive examples"); + + // plug together DL-Learner components + ComponentManager cm = ComponentManager.getInstance(); + + SparqlKnowledgeSource ks = cm.knowledgeSource(SparqlKnowledgeSource.class); + ks.getConfigurator().setInstances(instances); + ks.getConfigurator().setPredefinedEndpoint("LOCALGEODATA"); + //ks.getConfigurator().setPredefinedEndpoint("LOCALDBPEDIA"); + ks.getConfigurator().setSaveExtractedFragment(true); + Manipulator m = Manipulator.getDefaultManipulator(); + //m.addRule(new StringToResource(Months.NOVEMBER,"http://linkedgeodata.org/vocabulary", 0)); + m.addRule(new AddAllStringsAsClasses(Months.NOVEMBER, "http://linkedgeodata.org/vocabulary")); + ks.setManipulator(m); + ks.init(); + System.exit(0); + ReasonerComponent reasoner = cm.reasoner(FastInstanceChecker.class, ks); + reasoner.init(); + + PosOnlyLP lp = cm.learningProblem(PosOnlyLP.class, reasoner); + lp.getConfigurator().setPositiveExamples(positives); + lp.init(); + + CELOE celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); +// ROLComponent2 celoe = cm.learningAlgorithm(ROLComponent2.class, lp, reasoner); + celoe.getConfigurator().setUseAllConstructor(false); +// celoe.getConfigurator().setUseExistsConstructor(false); + celoe.getConfigurator().setUseCardinalityRestrictions(false); + celoe.getConfigurator().setUseBooleanDatatypes(false); + celoe.getConfigurator().setUseDoubleDatatypes(false); + celoe.getConfigurator().setUseNegation(false); + celoe.getConfigurator().setUseHasValueConstructor(true); + celoe.getConfigurator().setValueFrequencyThreshold(3); + celoe.getConfigurator().setMaxExecutionTimeInSeconds(100); + celoe.getConfigurator().setNoisePercentage(0.2); + celoe.init(); + + // debugging +// ObjectProperty place = new ObjectProperty("http://linkedgeodata.org/vocabulary#place"); +// Individual city = new Individual("http://linkedgeodata.org/vocabulary/city"); +// Individual village = new Individual("http://linkedgeodata.org/vocabulary/village"); +// Individual town = new Individual("http://linkedgeodata.org/vocabulary/town"); +// Individual suburb = new Individual("http://linkedgeodata.org/vocabulary/suburb"); +// Description vd = new ObjectValueRestriction(place, village); +// Description vc = new ObjectValueRestriction(place, city); +// Description vt = new ObjectValueRestriction(place, town); +// Description vs = new ObjectValueRestriction(place, suburb); +// Description d = new Union(vd, vt, vs); +// EvaluatedDescriptionPosOnly ed = lp.evaluate(d); +// System.out.println(ed); +// System.out.println(ed.getCoveredPositives().size() + ": " + ed.getCoveredPositives()); +// System.out.println(ed.getNotCoveredPositives().size() + ": " + ed.getNotCoveredPositives()); +// System.out.println(ed.getAdditionalInstances().size() + ": " + ed.getAdditionalInstances()); + + // execute algorithm + celoe.start(); +// Set<EvaluatedDescriptionPosOnly> solutions = (Set<EvaluatedDescriptionPosOnly>) algorithm.getCurrentlyBestEvaluatedDescriptions(); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-29 07:46:49
|
Revision: 1780 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1780&view=rev Author: jenslehmann Date: 2009-05-29 07:46:41 +0000 (Fri, 29 May 2009) Log Message: ----------- further fine tuning of geo matching Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-28 14:21:36 UTC (rev 1779) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-29 07:46:41 UTC (rev 1780) @@ -214,9 +214,9 @@ double matchFreq = 100*matches/(double)total; double matchCountFreq = 100*matches/(double)counter; long diffMs = currDate.getTime() - startDate.getTime(); - long diffMinutes = diffMs / (60 * 1000); long diffHours = diffMs / (60 * 60 * 1000); - double pointPercentage = total / (double) totalPOICount; + long diffMinutes = diffMs / (60 * 1000) - diffHours * 60; + double pointPercentage = 100 * total / (double) totalPOICount; double pointsPerMs = total / (double) diffMs; double pointsPerHour = 3600 * 1000 * pointsPerMs; long estimatedMs = totalPOICount * diffMs / total; @@ -396,7 +396,9 @@ queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary#name_int> ?name_int } ."; // filter out ways => we assume that it is always better to match a point and not a way // (if there is a way, there should also be a point but not vice versa) -// queryStr += "FILTER (?point LIKE <http://linkedgeodata.org/triplify/node/%>) ."; + // => according to OSM data model, ways do not have longitude/latitude, so we should + // always match nodes and not ways (TODO: discuss with Soeren) + queryStr += "FILTER (?point LIKE <http://linkedgeodata.org/triplify/node/%>) ."; queryStr += "}"; // SparqlQuery query = new SparqlQuery(queryStr, geoDataEndpoint); @@ -408,10 +410,8 @@ String bestLabel = null; while(rs.hasNext()) { QuerySolution qs = rs.nextSolution(); + String lgdURI = qs.getResource("point").toString(); - // measure string similarity and proximity - // TODO: incomplete - // step 1: string similarity double stringSimilarity; // from DBpedia we take the full label and an abbreviated version; @@ -442,18 +442,24 @@ double lat = qs.getLiteral("lat").getDouble(); double lon = qs.getLiteral("long").getDouble(); double distance = spatialDistance(dbpediaPoint.getGeoLat(), dbpediaPoint.getGeoLong(), lat, lon); - double frac = distance / dbpediaPoint.getPoiClass().getMaxBox(); - double distanceScore = Math.pow(frac-1,4); + double frac = Math.min(1,distance / dbpediaPoint.getPoiClass().getMaxBox()); + double distanceScore = Math.pow(frac-1,2); +// System.out.println(dbpediaPoint.getPoiClass().getMaxBox()); +// System.out.println(distance); +// System.out.println(frac); +// System.out.println(distanceScore); +// System.out.println("==============="); + double score = 0.8 * stringSimilarity + 0.2 * distanceScore; // if there is a node and a way, we prefer the node (better representative) - if(qs.getResource("point").toString().contains("/way/")) { - score -= 0.02; - } +// if(lgdURI.contains("/way/")) { +// score -= 0.02; +// } if(score > highestScore) { highestScore = score; - bestURI = qs.getResource("point").getURI(); + bestURI = lgdURI; bestLabel = lgdLabel1; } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-28 14:21:36 UTC (rev 1779) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-29 07:46:41 UTC (rev 1780) @@ -31,8 +31,8 @@ // 50 km box CITY (50000), - // 5 km box - AIRPORT (5000), + // 10 km box + AIRPORT (10000), // 10 km box UNIVERSITY (10000), @@ -53,11 +53,11 @@ // 10 km box MOUNTAIN (10000), - // 10000 km box (continents?) - ISLAND (10000000), + // 1000 km box (continents are not counted as islands in UMBEL and DBpedia ontology) + ISLAND (1000000), - // 1 km box - STADIUM (1000), + // 2 km box + STADIUM (2000), // 1000 km box RIVER (1000000), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-28 14:21:44
|
Revision: 1779 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1779&view=rev Author: jenslehmann Date: 2009-05-28 14:21:36 +0000 (Thu, 28 May 2009) Log Message: ----------- matching refined Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-28 12:28:40 UTC (rev 1778) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-28 14:21:36 UTC (rev 1779) @@ -84,7 +84,10 @@ private static int skipCount = 0; private static int counter = 0; private static int matches = 0; + private static Date startDate; + private static final int totalPOICount = 328232; + // read in DBpedia ontology such that we perform taxonomy reasoning // private static ReasonerComponent reasoner = TestOntologies.getTestOntology(TestOntology.DBPEDIA_OWL); // private static ClassHierarchy hierarchy = reasoner.getClassHierarchy(); @@ -124,6 +127,8 @@ Double geoLat = null; Double geoLong = null; + startDate = new Date(); + System.out.println("Start matching process at date " + startDate); while ((line = br.readLine()) != null) { if(line.isEmpty()) { @@ -192,12 +197,13 @@ } private static void printSummary() { - System.out.println("Summary at date " + new Date().toString()); + Date currDate = new Date(); + System.out.println("Summary at date " + currDate.toString()); for(POIClass poiClass : POIClass.values()) { int classTests = matchPerClass.get(poiClass)+noMatchPerClass.get(poiClass); - double per = classTests == 0 ? 0 : 100 * matchPerClass.get(poiClass)/(double)(classTests); - System.out.println("POI class " + poiClass + ": " + matchPerClass.get(poiClass) + " matches found, " + df.format(per) + "% match rate" ); + double per = (classTests == 0) ? 0 : 100 * matchPerClass.get(poiClass)/(double)(classTests); + System.out.println("POI class " + getFixedLengthString(poiClass,15) + ": " + getFixedLengthString(matchPerClass.get(poiClass),5) + " matches found from " + getFixedLengthString(classTests,5) + " POIs = " + df.format(per) + "% match rate" ); } // System.out.println(""); @@ -206,11 +212,31 @@ double skipFreq = 100*skipCount/(double)total; double countFreq = 100*counter/(double)total; double matchFreq = 100*matches/(double)total; + double matchCountFreq = 100*matches/(double)counter; + long diffMs = currDate.getTime() - startDate.getTime(); + long diffMinutes = diffMs / (60 * 1000); + long diffHours = diffMs / (60 * 60 * 1000); + double pointPercentage = total / (double) totalPOICount; + double pointsPerMs = total / (double) diffMs; + double pointsPerHour = 3600 * 1000 * pointsPerMs; + long estimatedMs = totalPOICount * diffMs / total; + Date estimatedDate = new Date(startDate.getTime() + estimatedMs); + System.out.println("algorithm runtime: " + diffHours + " hours " + diffMinutes + " minutes, estimated to finish at " + estimatedDate); + System.out.println(df.format(pointPercentage) + "% of points skipped or processed = " + df.format(pointsPerHour) + " points per hour"); System.out.println(skipCount + " POIs skipped (cannot be assigned to a POI class) = " + df.format(skipFreq) + "%"); System.out.println(counter + " POIs processed = " + df.format(countFreq) + "%"); - System.out.println(matches + " matches found = " + df.format(matchFreq) + "%"); + System.out.println(matches + " matches found = " + df.format(matchCountFreq) + "% of processed POIs, " + df.format(matchFreq) + "% of all POIs"); + System.out.println(); } + private static String getFixedLengthString(Object object, int length) { + String str = object.toString(); + for(int i = str.length(); i < length; i++ ) { + str = " " + str; + } + return str; + } + // downloads information about DBpedia into a separate file private static void createDBpediaFile() throws IOException { @@ -350,7 +376,11 @@ double minLat = dbpediaPoint.getGeoLat()-(distanceThresholdMeters/1000/111); double maxLat = dbpediaPoint.getGeoLat()+(distanceThresholdMeters/1000/111); double minLong = dbpediaPoint.getGeoLong()-(distanceThresholdMeters/1000)/Math.abs(Math.cos(Math.toRadians(dbpediaPoint.getGeoLat()))*111); - double maxLong = dbpediaPoint.getGeoLong()+(distanceThresholdMeters/1000)/Math.abs(Math.cos(Math.toRadians(dbpediaPoint.getGeoLat()))*111); + double maxLong = dbpediaPoint.getGeoLong()+(distanceThresholdMeters/1000)/Math.abs(Math.cos(Math.toRadians(dbpediaPoint.getGeoLat()))*111); + +// System.out.println("lat: " + minLat + " < " + dbpediaPoint.getGeoLat() + " < " + maxLat); +// System.out.println("long: " + minLong + " < " + dbpediaPoint.getGeoLong() + " < " + maxLong); + // query all points in the box corresponding to this class // (we make sure that returned points are in the same POI class) String queryStr = "select ?point ?lat ?long ?name ?name_en ?name_int where { "; @@ -398,7 +428,9 @@ if(qs.contains("name_en")) { String lgdLabel2 = qs.getLiteral("name_en").toString(); stringSimilarity = distance.score(dbpediaLabel1, lgdLabel2); - stringSimilarity = Math.max(distance.score(dbpediaLabel2, lgdLabel2), stringSimilarity); + stringSimilarity = Math.max(distance.score(dbpediaLabel2, lgdLabel2), stringSimilarity); + System.out.println(qs.getResource("point").getURI()); + System.exit(0); } if(qs.contains("name_int")) { String lgdLabel3 = qs.getLiteral("name_int").toString(); Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-28 12:28:40 UTC (rev 1778) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-28 14:21:36 UTC (rev 1779) @@ -94,6 +94,7 @@ try { dbpediaPoint = new DBpediaPoint(match.getKey()); } catch (Exception e) { +// System.out.println("discarded: " + match.getKey()); logger.debug(e.getMessage()); discarded++; continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-05-28 12:40:17
|
Revision: 1778 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1778&view=rev Author: heeroyuy Date: 2009-05-28 12:28:40 +0000 (Thu, 28 May 2009) Log Message: ----------- -changed config option "classToDescribe" to URL Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-05-28 06:23:15 UTC (rev 1777) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-05-28 12:28:40 UTC (rev 1778) @@ -20,6 +20,8 @@ package org.dllearner.tools.protege; +import java.net.MalformedURLException; +import java.net.URL; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -231,11 +233,9 @@ view.setIsInconsistent(false); isReasonerSet = true; }catch (ComponentInitException e) { - System.out.println("testen"); view.setIsInconsistent(true); //e.printStackTrace(); } catch (InconsistentOntologyException incon) { - System.out.println("test"); view.setIsInconsistent(true); } } @@ -262,7 +262,16 @@ */ public void setLearningProblem() { lp = cm.learningProblem(ClassLearningProblem.class, reasoner); - cm.applyConfigEntry(lp, "classToDescribe", currentConcept.toString()); + URL currentConceptURL = null; + try { + currentConceptURL = new URL(currentConcept.toString()); + } catch (MalformedURLException e1) { + // TODO Auto-generated catch block + String error = "Cannot convert to URL."; + view.renderErrorMessage(error); + e1.printStackTrace(); + } + cm.applyConfigEntry(lp, "classToDescribe", currentConceptURL); if (id.equals(EQUIVALENT_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-28 06:23:25
|
Revision: 1777 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1777&view=rev Author: jenslehmann Date: 2009-05-28 06:23:15 +0000 (Thu, 28 May 2009) Log Message: ----------- typo Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-28 05:44:58 UTC (rev 1776) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-28 06:23:15 UTC (rev 1777) @@ -141,7 +141,7 @@ String matchStr = "<" + dp.getUri() + "> <http://www.w3.org/2002/07/owl#sameAs> <" + matchURI + "> .\n"; fos.write(matchStr.getBytes()); matches++; - matchPerClass.put(poiClass, noMatchPerClass.get(poiClass)+1); + matchPerClass.put(poiClass, matchPerClass.get(poiClass)+1); } // System.out.println(poiClass); counter++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-28 05:45:05
|
Revision: 1776 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1776&view=rev Author: jenslehmann Date: 2009-05-28 05:44:58 +0000 (Thu, 28 May 2009) Log Message: ----------- standalone suggestion generator Added Paths: ----------- trunk/src/php-examples/Suggestions.php Added: trunk/src/php-examples/Suggestions.php =================================================================== --- trunk/src/php-examples/Suggestions.php (rev 0) +++ trunk/src/php-examples/Suggestions.php 2009-05-28 05:44:58 UTC (rev 1776) @@ -0,0 +1,39 @@ +<?php + +include('Utilities.php'); + +// load WSDL files (has to be done due to a Java web service bug) +ini_set("soap.wsdl_cache_enabled","0"); +$wsdluri="http://localhost:8181/services?wsdl"; +Utilities::loadWSDLfiles($wsdluri); + +$examples = array('http://dbpedia.org/resource/Leipzig', 'http://dbpedia.org/resource/Dresden'); + +$client = new SoapClient("main.wsdl",array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); + +$id = $client->generateID(); + +$ksID=$client->addKnowledgeSource($id,"sparql","http://dbpedia.org/sparql"); +$client->applyConfigEntryInt($id, $ksID, "recursionDepth", 1); +$relatedInstances = $client->getNegativeExamples($id,$ksID,$examples,count($examples),"http://dbpedia.org/resource/",array()); +$instances = array_merge($examples, $relatedInstances->item); +$client->applyConfigEntryStringArray($id, $ksID, "instances", $instances); + +// $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); +// $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", $this->endpoint); +// $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); + +$rID = $client->setReasoner($id, "fastInstanceChecker"); + +$client->setLearningProblem($id, "posOnlyLP"); +$client->setPositiveExamples($id, $examples); + +$laID = $client->setLearningAlgorithm($id, "celoe"); + +$client->initAll($id); + +echo 'start learning ... '; +$concept = $client->learnDescriptionsEvaluated($id, 5); +echo 'OK <br />'; + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <neb...@us...> - 2009-05-27 21:49:18
|
Revision: 1775 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1775&view=rev Author: nebelschwade Date: 2009-05-27 21:49:13 +0000 (Wed, 27 May 2009) Log Message: ----------- + Frontend changed for better usability + Frontend Performancefixes, JavaScript & Sprites + The Search now allows for searching Artist and Tags and actually returns sth. + Full Albums found in the search can now be played -> xspf-Playlistfile + FirePHP-Debugger + View-Class Changed general Filestructure and removed unused ARC-Framework Modified Paths: -------------- trunk/src/moosique.net/css/default.css trunk/src/moosique.net/css/style.css trunk/src/moosique.net/img/controls.png trunk/src/moosique.net/img/loading.gif trunk/src/moosique.net/index.php trunk/src/moosique.net/js/ajax.js trunk/src/moosique.net/js/interface.js trunk/src/moosique.net/js/mootools-core.js trunk/src/moosique.net/js/mootools-more.js trunk/src/moosique.net/js/player.js Added Paths: ----------- trunk/src/moosique.net/img/noArtistImage.png trunk/src/moosique.net/moosique/ trunk/src/moosique.net/moosique/classes/ trunk/src/moosique.net/moosique/classes/Config.php trunk/src/moosique.net/moosique/classes/Debugger.php trunk/src/moosique.net/moosique/classes/DllearnerConnection.php trunk/src/moosique.net/moosique/classes/FirePHP.php trunk/src/moosique.net/moosique/classes/LastFM.php trunk/src/moosique.net/moosique/classes/RequestHandler.php trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php trunk/src/moosique.net/moosique/classes/Utilities.php trunk/src/moosique.net/moosique/classes/View.php trunk/src/moosique.net/moosique/config.ini trunk/src/moosique.net/moosique/def0.xsd trunk/src/moosique.net/moosique/def1.xsd trunk/src/moosique.net/moosique/index.php trunk/src/moosique.net/moosique/main.wsdl trunk/src/moosique.net/moosique/xml2json/ trunk/src/moosique.net/moosique/xml2json/json.php trunk/src/moosique.net/moosique/xml2json/xml2json.php Removed Paths: ------------- trunk/src/moosique.net/img/bg_body.png trunk/src/moosique.net/img/del.png trunk/src/moosique.net/img/next.png trunk/src/moosique.net/img/pause.png trunk/src/moosique.net/img/play.png trunk/src/moosique.net/img/prev.png trunk/src/moosique.net/img/stop.png trunk/src/moosique.net/js/ie6fixes.js trunk/src/moosique.net/js/slimbox.js trunk/src/moosique.net/mp3/ trunk/src/moosique.net/php/ Modified: trunk/src/moosique.net/css/default.css =================================================================== --- trunk/src/moosique.net/css/default.css 2009-05-27 10:51:47 UTC (rev 1774) +++ trunk/src/moosique.net/css/default.css 2009-05-27 21:49:13 UTC (rev 1775) @@ -1,44 +1,44 @@ -@charset 'utf-8'; -@media all { /* Yes we want to reset this for print-Styles too */ -/* Based on various Reset-Styles, included own stuff and added mediabox-Style */ -/* Reset all elements except form stuff */ -html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; vertical-align: baseline; -} - -html { height: 100%; } -body { height: 101%; background-color: #fff; color: #000; line-height: 1; } -ol, ul { list-style: none; } -table { border-collapse: collapse; border-spacing: 0; } -caption, th, td { text-align: left; font-weight: normal; } -blockquote:before, blockquote:after, q:before, q:after { content: ""; } -blockquote, q { quotes: "" ""; } -strong, b { font-weight: bold; } -em, i { font-style: italic; } -label, input[type=button], input[type=submit], button { cursor: pointer; } -abbr[title] { border-bottom: 1px dotted #888 !important; cursor: help; } -a abbr { cursor: pointer !important; } - -/* General purpose-Classes */ -.hidden { position: absolute; left: -9999999em; top: -9999999em;} - -/* Clearfix hack */ -.clearfix:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; } -.clearfix { display: inline-block; } -* html .clearfix { height: 1%; } -.clearfix { display: block; } - -/* Special Stuff */ -:focus { outline: 0; } -a { text-decoration: none; } -a:hover { text-decoration: underline; } -a:active { position: relative; top: 1px; } -input:focus, textarea:focus, select:focus { background: #eee; } -fieldset { border: 1px solid #333; padding: 9px; } -fieldset legend { padding: 0 9px; } -h1, h2, h3, h4, h5, h6 { clear: both; font-weight: normal; } - -} /* End @media all */ \ No newline at end of file +@media all { /* Yes we want to reset this for print-Styles too */ +/* Based on various Reset-Styles, included own stuff and added mediabox-Style */ +/* Reset all elements except form stuff */ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; vertical-align: baseline; +} + +html { height: 100%; } +body { height: 101%; background-color: #fff; color: #000; line-height: 1; } +ol, ul { list-style: none; } +table { border-collapse: collapse; border-spacing: 0; } +caption, th, td { text-align: left; font-weight: normal; } +blockquote:before, blockquote:after, q:before, q:after { content: ""; } +blockquote, q { quotes: "" ""; } +strong, b { font-weight: bold; } +em, i { font-style: italic; } +label, input[type=button], input[type=submit], button { cursor: pointer; } +abbr[title] { border-bottom: 1px dotted #888 !important; cursor: help; } +a abbr { cursor: pointer !important; } + +/* General purpose-Classes */ +.hidden { position: absolute; left: -9999999em; top: -9999999em;} + +/* Clearfix hack */ +.clearfix:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; } +.clearfix { display: inline-block; } +* html .clearfix { height: 1%; } +.clearfix { display: block; } + +/* Special Stuff */ +:focus { outline: 0; } +a { text-decoration: none; } +a:hover { text-decoration: underline; } +a:active { position: relative; top: 1px; } +.ie6 a:active, .ie7 a:active { position: static; top: auto; } +input:focus, textarea:focus, select:focus { background: #eee; } +fieldset { border: 1px solid #333; padding: 9px; } +fieldset legend { padding: 0 9px; } +h1, h2, h3, h4, h5, h6 { clear: both; font-weight: normal; } + +} /* End @media all */ Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-05-27 10:51:47 UTC (rev 1774) +++ trunk/src/moosique.net/css/style.css 2009-05-27 21:49:13 UTC (rev 1775) @@ -1,12 +1,8 @@ -@charset 'utf-8'; -@import url(default.css); - /* moosique.net * * Semiblack: #131313 - * Dark Grey: #383838 * Light Grey: #545454 - * White: #fff + * White: #f8faf7 * Yellowish: #ffbc00 * */ @@ -16,14 +12,14 @@ /* Default Element Styling --- Start Editing below this line */ /* =================================================================== */ * { - font-family: Verdana, Arial, "Lucida Grande", Helvetica, sans-serif; - font-size: 14px; - line-height: 18px; - color: #fff; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + line-height: 16px; + color: #131313; } body { - background: #333; + background: #f8faf7; } a:hover { @@ -32,7 +28,7 @@ /* Abstand Zeilenhoehe nach unten bei manchen Elementen */ p, h1, h2, h3, h4, h5, h6, table, ul, ol, blockquote, pre, form { - margin-bottom: 18px; + margin-bottom: 16px; } /* Default Container Positioning */ @@ -42,25 +38,27 @@ } #headerContainer { - height: 140px; - background: #131313; - border-top: 1px solid #999; - border-bottom: 10px solid #ffbc00; + height: 95px; + background: #333; + border-bottom: 5px solid #ffbc00; + padding: 20px 0 0 0; } #header { - width: 960px; + width: 760px; margin: 0 auto; } #container { - border-top: 1px solid #1a1a1a; + border-top: 1px solid #ccc; } #mainContainer { - width: 960px; + width: 700px; margin: 0 auto; - padding: 30px 0; + padding: 30px; + border: 1px solid #ccc; + border-top: none; } #footer { @@ -71,316 +69,304 @@ /* header Area */ /* =================================================================== */ #header h1 a { - font-size: 36px; - line-height: 90px; - font-family: Georgia, "Times New Roman", Times, serif; + font-size: 32px; + line-height: 32px; + font-family: Georgia, Times, "Times New Roman", serif; text-decoration: none; + color: #f8faf7; } -#now { +#status, #header .currentlyPlaying { position: absolute; - top: 20px; - left: 280px; - width: 410px; - height: 37px; - padding: 10px 20px; - background: #545454; + top: 0; + right: 0; + width: 380px; + background: #545454; + padding: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; } -#now h2, #now h3, now p { - margin: 0; +#status { + background: #545454; + color: #f8faf7; + z-index: 1000000; + height: 32px; + line-height: 32px; + text-align: center; } -#now h2, #now p { - font-size: 11px; - line-height: 11px; +.currentlyPlaying h2, .currentlyPlaying h3, .currentlyPlaying h4 { + margin-bottom: 0; } -#now h3 { - font-size: 18px; - line-height: 24px; +#header .currentlyPlaying h2 { + font-size: 10px; } -#now p { +#header .currentlyPlaying h4 { position: absolute; - top: 10px; + bottom: 10px; right: 10px; - text-align: right; + font-size: 10px; } -#status { - position: absolute; - top: 83px; - left: 300px; - width: 410px; - font-size: 11px; +#searchForm input#searchValue { + margin: 0 5px; + width: 100px; } -#playerControls { +#loadingImg { + display: none; +} + +/* mainMenu & status */ +/* =================================================================== */ + +#mainMenu ul { position: absolute; - width: 116px; - height: 37px; - top: 20px; - right: 0; - padding: 10px 20px; - background: #545454; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; + top: 70px; + right: 0; } -#prev, #next, #stop, #playPause { - display: block; - width: 20px; - height: 37px; - text-decoration: none; - text-indent: -1000000px; +#mainMenu ul li { float: left; - margin-right: 10px; + -moz-border-radius-topleft: 10px; + -moz-border-radius-topright: 10px; + -webkit-border-top-left-radius: 10px; + -webkit-border-top-right-radius: 10px; + padding: 0 15px; + background: #545454; + margin: 5px 0 0 5px; + height: 20px; + line-height: 20px; } -#playPause { - width: 26px; +#mainMenu ul li a { + color: #131313; } -#next { - margin-right: 0; +#mainMenu ul li.active { + height: 25px; + line-height: 25px; + margin-top: 0; + background: #ffbc00; } -/* clicky feel */ -#prev:active, #next:active, #stop:active, #playPause:active { - position: relative; - top: 2px; +#mainMenu ul li.active a { + font-weight: bold; } -#prev { - background: url(../img/controls.png) 0px -160px no-repeat; +#mainMenu ul li a:hover { + text-decoration: none; } -#next { - background: url(../img/controls.png) 0px -120px no-repeat; + + +/* Content Area Default Styles */ +/* =================================================================== */ +#content h2, #content h3 { + font-size: 16px; + line-height: 24px; + font-weight: bold; } -#playPause { - background: url(../img/controls.png) 0px 0px no-repeat; -} -#stop { - background: url(../img/controls.png) 0px -80px no-repeat; -} -#toggles { - position: absolute; - width: 156px; - height: 18px; - top: 93px; - right: 0; - text-align: center; +/* for debugging */ +#content pre { + font-family: "Courier New", Courier, monospace; + font-size: 10px; } -#toggleMute, #togglePlaylist { - font-size: 11px; - text-decoration: none; +/* Initial hiding */ +#recommendations, #player, #information, #help { + display: none; /* Initial Hide */ } -#toggleMute { - padding-right: 10px; +#footer * { + font-size: 10px; } -/* Playlist Area */ +/* home -- search results */ /* =================================================================== */ - -#playlistContainer { - position: absolute; - width: 368px; - top: 30px; - right: 0; - background: #000; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - z-index: 100; - display: none; +#results h3 em { + font-size: 16px; } -#playlistHeader { - position: relative; - -moz-border-radius-topleft: 10px; - -moz-border-radius-topright: 10px; - -webkit-border-top-left-radius: 10px; - -webkit-border-top-right-radius: 10px; - background: #111; - padding: 5px 10px; - cursor: move; +#results ul li h3 a { + font-weight: normal; } -#playlistFooter { - position: absolute; - width: 100%; - bottom: 0; - -moz-border-radius-bottomleft: 10px; - -moz-border-radius-bottomright: 10px; - -webkit-border-bottom-left-radius: 10px; - -webkit-border-bottom-right-radius: 10px; - background: #111; - padding: 5px 0; - cursor: se-resize; +#results ul li img { + border: 2px solid #545454; + margin-bottom: 16px; } -#closePlaylist { - position: absolute; - width: 100px; - height: 20px; - top: 5px; - right: 10px; - text-align: right; - font-size: 10px; +#results ul li { + display: block; + border: 1px dotted #545454; + padding: 16px; + margin: 0 16px 16px 0; + float: left; + width: 300px; } -#playlist { - padding: 20px; - margin: 0 0 20px 0; +#results .artistSearch ul li { + height: 450px; } -#playlist li { - position: relative; /* Delete Buttons */ - list-style: decimal; - list-style-position: inside; - cursor: move; - padding: 3px; +#results ul ul { + list-style: square; } -#playlist li a.ymp-btn-page-pause { - font-weight: bold; +#results ul li ul li, +#results .artistSearch ul li ul li, +#results .tagSearch ul li ul li { + border: none; + display: list-item; + padding: 0; + margin: 0 0 0 32px; + width: auto; + height: auto; + float: none; } -/* Delete buttons */ -#playlist li a.del { - position: absolute; - display: block; - top: 5px; - right: 10px; - width: 14px; - height: 14px; - line-height: 14px; - margin-right: -19px; - z-index: 1000; - text-indent: -99999999px; - background: url(../img/controls.png) 0px -200px no-repeat; +#results .tagSearch ul li ul { + clear: both; } + -/* mainMenu */ -/* =================================================================== */ -#mainMenu ul { - position: absolute; - top: -46px; - left: 0; +#results .artistSearch ul li div.artistImage { + text-align: center; } -#mainMenu ul li { +#results .tagSearch ul li div.cover { + margin-right: 16px; + width: 110px; float: left; - -moz-border-radius-topleft: 10px; - -moz-border-radius-topright: 10px; - -webkit-border-top-left-radius: 10px; - -webkit-border-top-right-radius: 10px; - padding: 0 15px; - background: #545454; - margin: 5px 5px 0 0; - height: 30px; - line-height: 30px; } -#mainMenu ul li a { - color: #131313; +#results .tagSearch ul li h4 { + display: inline; + font-weight: bold; } -#mainMenu ul li.active { - height: 35px; - line-height: 35px; - margin-top: 0; - background: #ffbc00; + + + + +/* Recommendations */ +/* =================================================================== */ +#recommended { + list-style: decimal; + margin-left: 24px; } -#mainMenu ul li.active a { +#recommended li { + line-height: 24px; +} + +#recommended a:hover { + cursor: pointer; + text-decoration: none; font-weight: bold; + color: #131313; } -/* Content Area Default Styles */ + +/* information */ /* =================================================================== */ -#mainContainer h2 { - font-size: 20px; - line-height: 28px; - font-weight: bold; -} -/* for debugging */ -#mainContainer pre { - font-size: 12px; - font-family: "Courier New", Courier, monospace; -} -/* search */ +/* player */ /* =================================================================== */ -#searchForm * { - color: #131313; + +#playerControls { + position: absolute; + width: 149px; + height: 37px; + top: 0; + right: 0; + padding: 10px 20px; + background: #545454; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; } +#prev, #next, #stop, #playPause, #mute { + display: block; + width: 20px; + height: 37px; + text-decoration: none; + text-indent: -1000000px; + float: left; + margin-right: 10px; +} -/* Recommendations */ -/* =================================================================== */ -#recommendations { - display: none; /* Initial Hide */ +/* clicky feel */ +#prev:active, #next:active, #stop:active, +#playPause:active, #mute:active { + position: relative; + top: 2px; } -#recommendations ol { - list-style: decimal; - margin-left: 24px; - width: 50%; +/* Sprites */ +#prev { background: url(../img/controls.png) 0px -160px no-repeat; } +#next { background: url(../img/controls.png) 0px -120px no-repeat; } +#stop { background: url(../img/controls.png) 0px -80px no-repeat; } + +#playPause { + background: url(../img/controls.png) 0px 0px no-repeat; + width: 26px; } -#recommendations ol li a { +#mute { + background: url(../img/controls.png) 0px -280px no-repeat; + margin-right: 0; + width: 23px; +} +/* End Sprites */ + +#playlist li { + position: relative; /* Delete Buttons */ + list-style: decimal; + list-style-position: inside; cursor: move; - text-decoration: none; + padding: 3px; } -#recommendations ol li a:hover { - text-decoration: none; - color: #fff; +#playlist li a.ymp-btn-page-pause { + font-weight: bold; } -#recommendations li:hover { - border: 1px solid #ffbc00; +/* Delete buttons */ +#playlist li a.del { + position: absolute; + display: block; + top: 5px; + right: 20px; + width: 14px; + height: 14px; + line-height: 14px; + margin-right: -19px; + z-index: 1000; + text-indent: -99999999px; + background: url(../img/controls.png) 0px -200px no-repeat; } - /* Draggable li-Items */ -#playlist li.moving, #recommendations li.moving { +#playlist li.moving { background: #666; border: 3px solid #ffbc00; - color: #000; font-weight: bold; } -/* information */ -/* =================================================================== */ -#information { - display: none; /* Initial Hide */ -} -/* Sidebar Area */ -/* =================================================================== */ - -/* Footer Area */ -/* =================================================================== */ -#footer a { - font-size: 11px; -} - - -} /* end @media screen \ No newline at end of file +} /* end @media screen */ \ No newline at end of file Deleted: trunk/src/moosique.net/img/bg_body.png =================================================================== (Binary files differ) Modified: trunk/src/moosique.net/img/controls.png =================================================================== (Binary files differ) Deleted: trunk/src/moosique.net/img/del.png =================================================================== (Binary files differ) Modified: trunk/src/moosique.net/img/loading.gif =================================================================== (Binary files differ) Deleted: trunk/src/moosique.net/img/next.png =================================================================== (Binary files differ) Added: trunk/src/moosique.net/img/noArtistImage.png =================================================================== (Binary files differ) Property changes on: trunk/src/moosique.net/img/noArtistImage.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: trunk/src/moosique.net/img/pause.png =================================================================== (Binary files differ) Deleted: trunk/src/moosique.net/img/play.png =================================================================== (Binary files differ) Deleted: trunk/src/moosique.net/img/prev.png =================================================================== (Binary files differ) Deleted: trunk/src/moosique.net/img/stop.png =================================================================== (Binary files differ) Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-05-27 10:51:47 UTC (rev 1774) +++ trunk/src/moosique.net/index.php 2009-05-27 21:49:13 UTC (rev 1775) @@ -1,10 +1,11 @@ -<!DOCTYPE html +<?php session_start(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>moosique.net</title> + <link href="css/default.css" rel="stylesheet" type="text/css" /> <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> @@ -16,120 +17,135 @@ <div id="headerContainer"> <div id="header"> <h1><a href="index.php">moosique.net</a></h1> - <div id="now"> - <h2>Player stopped</h2> - <h3>...</h3> - <p>0:00 / 0:00</p> - </div> - <div id="status"> + <div id="mainMenu"> + <ul class="clearfix"> + <li class="active"><a href="#" class="home">Home</a></li> + <li><a href="#" class="player">Player</a></li> + <li><a href="#" class="recommendations">Recommendations</a></li> + <li><a href="#" class="information">Information</a></li> + <li><a href="#" class="help">Help</a></li> + </ul> </div> - <div id="playerControls"> - <a href="#" id="prev" title="Play previous Track in Playlist">Previous Tack</a> - <a href="#" id="playPause" title="Play/Pause">Play / Pause</a> - <a href="#" id="stop" title="Stop playing">Stop</a> - <a href="#" id="next" title="Play next Track in Playlist">Next Track</a> + <form id="searchForm" method="get" action="moosique/"> + <div class="clearfix"> + <select name="typeOfSearch" id="typeOfSearch"> + <option value="artistSearch">Artist</option> + <option value="tagSearch">Tag</option> + <?php /* + <option value="songSearch">Song</option> + <option value="lastfm">Last.fm-User</option> + */ ?> + </select> + <input id="searchValue" name="searchValue" type="text" /> + <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" disabled="disabled" /> + <img id="loadingImg" src="img/loading.gif" alt="Loading..." /> + </div> + </form> + + <div id="status"> </div> + + <div class="currentlyPlaying"> + <h2>Player stopped</h2> + <h3>...</h3> + <h4>0:00 / 0:00</h4> </div> - <div id="toggles"> - <a href="#" id="toggleMute" title="Sound on/off">Mute</a> - <a href="#" id="togglePlaylist" title="Show/Hide Playlist">Playlist</a> - </div> </div> </div> <div id="container"> - <div id="mainContainer"> - <div id="mainMenu"> - <ul class="clearfix"> - <li class="active"><a href="#" class="search">Search</a></li> - <li><a href="#" class="recommendations">Recommendations</a></li> - <li><a href="#" class="information">Information</a></li> - </ul> - </div> - <div id="content"> + <div id="content" class="clearfix"> - - <div id="search"> - <h2>Welcome to moosique.net!</h2> - <p> - Want to listen to some good free music? Just enter an artist or song - name, search for tags or enter your last.fm username and let the moogic - happen... - </p> - <form id="searchForm" method="post" action="php/ajaxer.php"> - <div> - <select name="typeOfSearch" id="typeOfSearch"> - <option value="artist">Artist</option> - <option value="song">Songtitle</option> - <option value="tag">Tag</option> - <option value="lastfm">Last.fm-User</option> - </select> - <input id="searchValue" name="searchValue" type="text" /> - <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" /> - </div> - </form> + <div id="home"> + <div id="welcome"> + <h2>Welcome to moosique.net!</h2> + <p> + Want to listen to some good free music? Just enter an artist or song + name or search for music using tags <!-- or enter your last.fm username --> and let the moogic + happen. By listening to songs you like, the system will automatically learn about + your musical taste and generate recommendations. You can find them in the tab »Recommendations«. + </p> + <p> + You can find information about the song currently playing in the tab »Information« and view + your Playlist and control the Player in the Tab »Player«. + </p> + <p> + Now get started and add something to the Playlist! + </p> + </div> <div id="results"> </div> </div> <div id="recommendations"> - <h2>Try dragging these samples to the playlist</h2> - <ol> - <li><a href="http://stream6-3.jamendo.com/8654/mp31/01%20-%20Low%20Earth%20Orbit%20-%20My%20Mistakes.mp3">Low Earth Orbit - My Mistakes</a></li> - <li><a href="http://stream6-3.jamendo.com/8654/mp31/02%20-%20Low%20Earth%20Orbit%20-%20Like%20Mud.mp3">Low Earth Orbit - Like Mud</a></li> - <li><a href="http://stream6-3.jamendo.com/8654/mp31/03%20-%20Low%20Earth%20Orbit%20-%20Defend.mp3">Low Earth Orbit - Defend</a></li> - <li><a href="http://stream6-3.jamendo.com/8654/mp31/04%20-%20Low%20Earth%20Orbit%20-%20What%20Can%20I%20Say.mp3">Low Earth Orbit - What Can I Say</a></li> + <h2>Recommended Songs</h2> + <p>Click a song to add it to your playlist.</p> + <ol id="recommended"> + <li></li> </ol> </div> <div id="information"> - <div id="sidebar"> - <div id="moreInfo"> - <h2>About the Artist</h2> - <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> - <p> - Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat - duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil - imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis - dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus - qui nobis videntur parum. - </p> - </div> + <div id="moreInfo"> + <h2>About the Artist</h2> + <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> + <p> + Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat + duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil + imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis + dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus + qui nobis videntur parum. + </p> </div> </div> + + <div id="player"> + <h3>Playlist</h3> + <p> + You can delete entries from the playlist by clicking the small x on the left. <br /> + You also can move the playlist-entries around to change their order. + </p> - </div> + <ol id="playlist"> + <li></li> + </ol> - <div id="playlistContainer"> - <div id="playlistHeader"> - Playlist - <a href="#" id="closePlaylist" title="Close Playlist Window">Close Window</a> + <div id="playerControls"> + <a href="#" id="playPause" title="Play/Pause">Play / Pause</a> + <a href="#" id="stop" title="Stop playing">Stop</a> + <a href="#" id="prev" title="Play previous Track in Playlist">Previous Tack</a> + <a href="#" id="next" title="Play next Track in Playlist">Next Track</a> + <a href="#" id="mute" title="Sound on/off">Mute</a> + </div> + </div> - <ol id="playlist"> - <li><a href="mp3/moosique.mp3" class="htrack">Welcome to moosique</a></li> - </ol> - <div id="playlistFooter"> </div> - </div> - - <div id="footer"> - <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> | - <a href="http://aksw.org/Projects/DLLearner">Powered by DL-Learner</a> - </div> + + <div id="help"> + + </div> + + </div> <!-- end content --> + </div> <!-- end mainContainer --> + <div id="footer"> + <a href="http://jamendo.com">Jamendo</a> | + <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> | + <a href="http://aksw.org/Projects/DLLearner">Powered by DL-Learner</a> </div> - </div> + </div> <!-- end container --> <!-- JS at the bottom, faster loading pages --> + <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> + <script type="text/javascript" src="js/mootools-core.js"></script> <script type="text/javascript" src="js/mootools-more.js"></script> - <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> - + <script type="text/javascript" src="js/player.js"></script> <script type="text/javascript" src="js/interface.js"></script> <script type="text/javascript" src="js/ajax.js"></script> Modified: trunk/src/moosique.net/js/ajax.js =================================================================== --- trunk/src/moosique.net/js/ajax.js 2009-05-27 10:51:47 UTC (rev 1774) +++ trunk/src/moosique.net/js/ajax.js 2009-05-27 21:49:13 UTC (rev 1775) @@ -1,55 +1,93 @@ window.addEvent('domready', function() { -var responseObject = ''; - // handle search requests $('searchForm').addEvent('submit', function(e) { var results = $('results'); var submit = $('searchSubmit'); + var loading = $('loadingImg'); e.stop(); // prevent form submitting the non-ajax way this.set('send', { - onRequest: function(response) { + onRequest: function() { submit.set('disabled', 'disabled'); // disable submit button until request complete - results.set('html', '<h2>Processing your search request...</h2>'); + // show homescreen for resultdisplaying + showTab('home'); + submit.setStyle('display', 'none'); + loading.setStyle('display', 'inline'); + results.set('html', '<h2>Searching...</h2>'); }, - onFailure: function(response) { + onFailure: function() { results.set('html', '<h2>Unable to process your search. Try again.</h2>'); }, onSuccess: function(response) { submit.erase('disabled'); // reenable submitbutton - responseObject = JSON.decode(response); - // info.set('text', response); - results.set('html', '<h2>Done.</h2>'); - // Firebug needed - console.log(responseObject); - - - - /* - var newPlaylistItem = new Element('a', { - 'href': responseObject.playlist.trackList.track.location, - 'html': responseObject.playlist.trackList.track.creator + ' - ' + responseObject.playlist.trackList.track.title - }); + submit.setStyle('display', 'inline'); + loading.setStyle('display', 'none'); - newPlaylistItem.inject(info); - */ + // if the welcome-text ist present, cut it to help + if ($('welcome')) { + if ($('welcome').get('html').length > 100) { + $('help').set('html', $('welcome').get('html')); + $('welcome').destroy(); + } + } + + // display results + results.set('html', response); + + // addEvents to result-links + makeAddable(); } - - - }); - this.send(); + // only send form if value is at least 3 + if ($('searchValue').get('value').length > 2) { + this.send(); + } - }); +makeAddable(); +}); -}); \ No newline at end of file + +/** + * For Recommendations and Search-Results + */ +function makeAddable() { + $$('a.addToPlaylist').each(function(a) { + a.addEvent('click', function(e) { + e.stop(); // dont follow link + // remove the class from preventing adding again + + a.removeClass('addToPlaylist'); + + // TODO, now using xspfs, later we only will use mp3-links + a.set('type', 'application/xspf+xml'); + + // if the Playlist is empty, remove entries + if ($('playlist').getFirst()) { + if ($('playlist').getFirst().get('text') == '') { + $('playlist').empty(); + } + } + + + a.getParent().inject($('playlist')); + if (a.get('title')) { + a.set('text', a.get('title')); + } + + // + mooPlayer.refreshPlaylist(); + showTab('player'); + + }); + }); +} \ No newline at end of file Deleted: trunk/src/moosique.net/js/ie6fixes.js =================================================================== --- trunk/src/moosique.net/js/ie6fixes.js 2009-05-27 10:51:47 UTC (rev 1774) +++ trunk/src/moosique.net/js/ie6fixes.js 2009-05-27 21:49:13 UTC (rev 1775) @@ -1,48 +0,0 @@ -window.addEvent('domready', function() { - if (Browser.Engine.trident4) { - - // PNG-Support for IE6 for all img-Tags - $$('img').each(function(i) { - // additional styles - iStyle = "display: inline-block; "; - if (i.getParent().get('href') !== "") { - iStyle += "cursor: pointer; " - } - // if the img-src is a .png - var iName = i.get('src').toLowerCase(); - if (iName.substring(iName.length - 3, iName.length) == "png") { - var strNewHTML = '<span id="' + i.get('id') + - '" class="'+ i.get('class') + - '" style="' + iStyle + - 'width: ' + i.getSize().x + - 'px; height: ' + i.getSize().y + - 'px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + - "(src=\'" + i.getProperty('src') + "\', sizingMethod='scale');\"></span>"; - i.outerHTML = strNewHTML; - } - }); - - // PNG-Background-Image-Support for chosen tags (edit for performance) - $$('div', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'form').each(function(el) { - var bgImg = el.getStyle('background-image'); - if (bgImg.contains('.png')) { - var expression = /url\("(.*\.png)"\)/; // IE-only, other browsers dont "" - var result = expression.exec(bgImg); - var imgUrl = result[1]; - - var method = 'crop'; - // if repeat-x or y scale the image, does not work for patterns - if ( el.getStyle('background-repeat') == 'repeat-x' || - el.getStyle('background-repeat') == 'repeat-y') { - method = 'scale'; - } - if (imgUrl.length > 4) { - el.setStyles({ - 'background-image': 'none', - 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgUrl + "', sizingMethod='" + method + "');" - }); - } - } - }); - } -}); \ No newline at end of file Modified: trunk/src/moosique.net/js/interface.js =================================================================== --- trunk/src/moosique.net/js/interface.js 2009-05-27 10:51:47 UTC (rev 1774) +++ trunk/src/moosique.net/js/interface.js 2009-05-27 21:49:13 UTC (rev 1775) @@ -5,13 +5,32 @@ $$('#mainMenu ul li a').each(function(a) { a.addEvent('click', function(e) { e.stop(); // dont follow link - $$('#mainMenu ul li').removeClass('active'); - a.getParent().toggleClass('active'); - console.log(a.get('class')); - $('content').getChildren().setStyle('display', 'none') - $(a.get('class')).setStyle('display', 'block'); + showTab(a.get('class').toString()); }); }); -}); \ No newline at end of file +$('searchValue').addEvent('keyup', function() { + if (this.get('value').length > 2) { + $('searchSubmit').erase('disabled'); + } else { + $('searchSubmit').set('disabled', 'disabled'); + } +}); + + +}); + +/** + * + * @param {String} tabID ID of the Tab to show + */ +function showTab(tabID) { + $$('#mainMenu ul li').removeClass('active'); + $$('#mainMenu ul li a.' + tabID).getParent().toggleClass('active'); + $('content').getChildren().setStyle('display', 'none') + $(tabID).setStyle('display', 'block'); + +} + + Modified: trunk/src/moosique.net/js/mootools-core.js =================================================================== --- trunk/src/moosique.net/js/mootools-core.js 2009-05-27 10:51:47 UTC (rev 1774) +++ trunk/src/moosique.net/js/mootools-core.js 2009-05-27 21:49:13 UTC (rev 1775) @@ -1,129 +1,352 @@ -//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2008 Valerio Proietti, <http://mad4milk.net>, MIT Style License. +//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License. -var MooTools={'version':'1.2.1','build':'0d4845aab3d9a4fdee2f0d4a6dd59210e4b697cf'};var Native=function(options){options=options||{};var name=options.name;var legacy=options.legacy;var protect=options.protect;var methods=options.implement;var generics=options.generics;var initialize=options.initialize;var afterImplement=options.afterImplement||function(){};var object=initialize||legacy;generics=generics!==false;object.constructor=Native;object.$family={name:'native'};if(legacy&&initialize)object.prototype=legacy.prototype;object.prototype.constructor=object;if(name){var family=name.toLowerCase();object.prototype.$family={name:family};Native.typize(object,family);} -var add=function(obj,name,method,force){if(!protect||force||!obj.prototype[name])obj.prototype[name]=method;if(generics)Native.genericize(obj,name,protect);afterImplement.call(obj,name,method);return obj;};object.alias=function(a1,a2,a3){if(typeof a1=='string'){if((a1=this.prototype[a1]))return add(this,a2,a1,a3);} -for(var a in a1)this.alias(a,a1[a],a2);return this;};object.implement=function(a1,a2,a3){if(typeof a1=='string')return add(this,a1,a2,a3);for(var p in a1)add(this,p,a1[p],a2);return this;};if(methods)object.implement(methods);return object;};Native.genericize=function(object,property,check){if((!check||!object[property])&&typeof object.prototype[property]=='function')object[property]=function(){var args=Array.prototype.slice.call(arguments);return object.prototype[property].apply(args.shift(),args);};};Native.implement=function(objects,properties){for(var i=0,l=objects.length;i<l;i++)objects[i].implement(properties);};Native.typize=function(object,family){if(!object.type)object.type=function(item){return($type(item)===family);};};(function(){var natives={'Array':Array,'Date':Date,'Function':Function,'Number':Number,'RegExp':RegExp,'String':String};for(var n in natives)new Native({name:n,initialize:natives[n],protect:true});var types={'boolean':Boolean,'native':Native,'object':Object};for(var t in types)Native.typize(types[t],t);var generics={'Array':["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],'String':["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};for(var g in generics){for(var i=generics[g].length;i--;)Native.genericize(window[g],generics[g][i],true);};})();var Hash=new Native({name:'Hash',initialize:function(object){if($type(object)=='hash')object=$unlink(object.getClean());for(var key in object)this[key]=object[key];return this;}});Hash.implement({forEach:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key))fn.call(bind,this[key],key,this);}},getClean:function(){var clean={};for(var key in this){if(this.hasOwnProperty(key))clean[key]=this[key];} -return clean;},getLength:function(){var length=0;for(var key in this){if(this.hasOwnProperty(key))length++;} -return length;}});Hash.alias('forEach','each');Array.implement({forEach:function(fn,bind){for(var i=0,l=this.length;i<l;i++)fn.call(bind,this[i],i,this);}});Array.alias('forEach','each');function $A(iterable){if(iterable.item){var array=[];for(var i=0,l=iterable.length;i<l;i++)array[i]=iterable[i];return array;} -return Array.prototype.slice.call(iterable);};function $arguments(i){return function(){return arguments[i];};};function $chk(obj){return!!(obj||obj===0);};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};function $defined(obj){return(obj!=undefined);};function $each(iterable,fn,bind){var type=$type(iterable);((type=='arguments'||type=='collection'||type=='array')?Array:Hash).each(iterable,fn,bind);};function $empty(){};function $extend(original,extended){for(var key in(extended||{}))original[key]=extended[key];return original;};function $H(object){return new Hash(object);};function $lambda(value){return(typeof value=='function')?value:function(){return value;};};function $merge(){var mix={};for(var i=0,l=arguments.length;i<l;i++){var object=arguments[i];if($type(object)!='object')continue;for(var key in object){var op=object[key],mp=mix[key];mix[key]=(mp&&$type(op)=='object'&&$type(mp)=='object')?$merge(mp,op):$unlink(op);}} -return mix;};function $pick(){for(var i=0,l=arguments.length;i<l;i++){if(arguments[i]!=undefined)return arguments[i];} -return null;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $splat(obj){var type=$type(obj);return(type)?((type!='array'&&type!='arguments')?[obj]:obj):[];};var $time=Date.now||function(){return+new Date;};function $try(){for(var i=0,l=arguments.length;i<l;i++){try{return arguments[i]();}catch(e){}} -return null;};function $type(obj){if(obj==undefined)return false;if(obj.$family)return(obj.$family.name=='number'&&!isFinite(obj))?false:obj.$family.name;if(obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}else if(typeof obj.length=='number'){if(obj.callee)return'arguments';else if(obj.item)return'collection';} -return typeof obj;};function $unlink(object){var unlinked;switch($type(object)){case'object':unlinked={};for(var p in object)unlinked[p]=$unlink(object[p]);break;case'hash':unlinked=new Hash(object);break;case'array':unlinked=[];for(var i=0,l=object.length;i<l;i++)unlinked[i]=$unlink(object[i]);break;default:return object;} -return unlinked;};var Browser=$merge({Engine:{name:'unknown',version:0},Platform:{name:(window.orientation!=undefined)?'ipod':(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?5:4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);},gecko:function(){return(document.getBoxObjectFor==undefined)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var engine in this.Engines){var version=this.Engines[engine]();if(version){this.Engine={name:engine,version:version};this.Engine[engine]=this.Engine[engine+version]=true;break;}} -return{name:engine,version:version};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('MSXML2.XMLHTTP');});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var version=($try(function(){return navigator.plugins['Shockwave Flash'].description;},function(){return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');})||'0 r0').match(/\d+/g);return{version:parseInt(version[0]||0+'.'+version[1]||0),build:parseInt(version[2]||0)};})();function $exec(text){if(!text)return text;if(window.execScript){window.execScript(text);}else{var script=document.createElement('script');script.setAttribute('type','text/javascript');script[(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerText':'text']=text;document.head.appendChild(script);document.head.removeChild(script);} -return text;};Native.UID=1;var $uid=(Browser.Engine.trident)?function(item){return(item.uid||(item.uid=[Native.UID++]))[0];}:function(item){return item.uid||(item.uid=Native.UID++);};var Window=new Native({name:'Window',legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(win){$uid(win);if(!win.Element){win.Element=$empty;if(Browser.Engine.webkit)win.document.createElement("iframe");win.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};} -win.document.window=win;return $extend(win,Window.Prototype);},afterImplement:function(property,value){window[property]=Window.Prototype[property]=value;}});Window.Prototype={$family:{name:'window'}};new Window(window);var Document=new Native({name:'Document',legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(doc){$uid(doc);doc.head=doc.getElementsByTagName('head')[0];doc.html=doc.getElementsByTagName('html')[0];if(Browser.Engine.trident&&Browser.Engine.version<=4)$try(function(){doc.execCommand("BackgroundImageCache",false,true);});if(Browser.Engine.trident)doc.window.attachEvent('onunload',function(){doc.window.detachEvent('onunload',arguments.callee);doc.head=doc.html=doc.window=null;});return $extend(doc,Document.Prototype);},afterImplement:function(property,value){document[property]=Document.Prototype[property]=value;}});Document.Prototype={$family:{name:'document'}};new Document(document);Array.implement({every:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(!fn.call(bind,this[i],i,this))return false;} -return true;},filter:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))results.push(this[i]);} -return results;},clean:function(){return this.filter($defined);},indexOf:function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){if(this[i]===item)return i;} -return-1;},map:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++)results[i]=fn.call(bind,this[i],i,this);return results;},some:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))return true;} -return false;},associate:function(keys){var obj={},length=Math.min(this.length,keys.length);for(var i=0;i<length;i++)obj[keys[i]]=this[i];return obj;},link:function(object){var result={};for(var i=0,l=this.length;i<l;i++){for(var key in object){if(object[key](this[i])){result[key]=this[i];delete object[key];break;}}} -return result;},contains:function(item,from){return this.indexOf(item,from)!=-1;},extend:function(array){for(var i=0,j=array.length;i<j;i++)this.push(array[i]);return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;},include:function(item){if(!this.contains(item))this.push(item);return this;},combine:function(array){for(var i=0,l=array.length;i<l;i++)this.include(array[i]);return this;},erase:function(item){for(var i=this.length;i--;i){if(this[i]===item)this.splice(i,1);} -return this;},empty:function(){this.length=0;return this;},flatten:function(){var array=[];for(var i=0,l=this.length;i<l;i++){var type=$type(this[i]);if(!type)continue;array=array.concat((type=='array'||type=='collection'||type=='arguments')?Array.flatten(this[i]):this[i]);} -return array;},hexToRgb:function(array){if(this.length!=3)return null;var rgb=this.map(function(value){if(value.length==1)value+=value;return value.toInt(16);});return(array)?rgb:'rgb('+rgb+')';},rgbToHex:function(array){if(this.length<3)return null;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);} -return(array)?hex:'#'+hex.join('');}});Function.implement({extend:function(properties){for(var property in properties)this[property]=properties[property];return this;},create:function(options){var self=this;options=options||{};return function(event){var args=options.arguments;args=(args!=undefined)?$splat(args):Array.slice(arguments,(options.event)?1:0);if(options.event)args=[event||window.event].extend(args);var returns=function(){return self.apply(options.bind||null,args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)return $try(returns);return returns();};},run:function(args,bind){return this.apply(bind,$splat(args));},pass:function(args,bind){return this.create({bind:bind,arguments:args});},bind:function(bind,args){return this.create({bind:bind,arguments:args});},bindWithEvent:function(bind,args){return this.create({bind:bind,arguments:args,event:true});},attempt:function(args,bind){return this.create({bind:bind,arguments:args,attempt:true})();},delay:function(delay,bind,args){return this.create({bind:bind,arguments:args,delay:delay})();},periodical:function(periodical,bind,args){return this.create({bind:bind,arguments:args,periodical:periodical})();}});Number.implement({limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn,bind){for(var i=0;i<this;i++)fn.call(bind,i,this);},toFloat:function(){return parseFloat(this);},toInt:function(base){return parseInt(this,base||10);}});Number.alias('times','each');(function(math){var methods={};math.each(function(name){if(!Number[name])methods[name]=function(){return Math[name].apply(null,[this].concat($A(arguments)));};});Number.implement(methods);})(['abs','acos','asin','atan','atan2','ceil','cos','exp','floor','log','max','min','pow','sin','sqrt','tan']);String.implement({test:function(regex,params){return((typeof regex=='string')?new RegExp(regex,params):regex).test(this);},contains:function(string,separator){return(separator)?(separator+this+separator).indexOf(separator+string+separator)>-1:this.indexOf(string)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,'');},clean:function(){return this.replace(/\s+/g,' ').trim();},camelCase:function(){return this.replace(/-\D/g,function(match){return match.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(match){return('-'+match.charAt(0).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(match){return match.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1');},toInt:function(base){return parseInt(this,base||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(array){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(array):null;},rgbToHex:function(array){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(array):null;},stripScripts:function(option){var scripts='';var text=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){scripts+=arguments[1]+'\n';return'';});if(option===true)$exec(scripts);else if($type(option)=='function')option(scripts,text);return text;},substitute:function(object,regexp){return this.replace(regexp||(/\\?\{([^{}]+)\}/g),function(match,name){if(match.charAt(0)=='\\')return match.slice(1);return(object[name]!=undefined)?object[name]:'';});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(value){for(var key in this){if(this.hasOwnProperty(key)&&this[key]===value)return key;} -return null;},hasValue:function(value){return(Hash.keyOf(this,value)!==null);},extend:function(properties){Hash.each(properties,function(value,key){Hash.set(this,key,value);},this);return this;},combine:function(properties){Hash.each(properties,function(value,key){Hash.include(this,key,value);},this);return this;},erase:function(key){if(this.hasOwnProperty(key))delete this[key];return this;},get:function(key){return(this.hasOwnProperty(key))?this[key]:null;},set:function(key,value){if(!this[key]||this.hasOwnProperty(key))this[key]=value;return this;},empty:function(){Hash.each(this,function(value,key){delete this[key];},this);return this;},include:function(key,value){var k=this[key];if(k==undefined)this[key]=value;return this;},map:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){results.set(key,fn.call(bind,value,key,this));},this);return results;},filter:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){if(fn.call(bind,value,key,this))results.set(key,value);},this);return results;},every:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&!fn.call(bind,this[key],key))return false;} -return true;},some:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&fn.call(bind,this[key],key))return true;} -return false;},getKeys:function(){var keys=[];Hash.each(this,function(value,key){keys.push(key);});return keys;},getValues:function(){var values=[];Hash.each(this,function(value){values.push(value);});return values;},toQueryString:function(base){var queryString=[];Hash.each(this,function(value,key){if(base)key=base+'['+key+']';var result;switch($type(value)){case'object':result=Hash.toQueryString(value,key);break;case'array':var qs={};value.each(function(val,i){qs[i]=val;});result=Hash.toQueryString(qs,key);break;default:result=key+'='+encodeURIComponent(value);} -if(value!=undefined)queryString.push(result);});return queryString.join('&');}});Hash.alias({keyOf:'indexOf',hasValue:'contains'});var Event=new Native({name:'Event',initialize:function(event,win){win=win||window;var doc=win.document;event=event||win.event;if(event.$extended)return event;this.$extended=true;var type=event.type;var target=event.target||event.srcElement;while(target&&target.nodeType==3)target=target.parentNode;if(type.test(/key/)){var code=event.which||event.keyCode;var key=Event.Keys.keyOf(code);if(type=='keydown'){var fKey=code-111;if(fKey>0&&fKey<13)key='f'+fKey;} -key=key||String.fromCharCode(code).toLowerCase();}else if(type.match(/(click|mouse|menu)/i)){doc=(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;var page={x:event.pageX||event.clientX+doc.scrollLeft,y:event.pageY||event.clientY+doc.scrollTop};var client={x:(event.pageX)?event.pageX-win.pageXOffset:event.clientX,y:(event.pageY)?event.pageY-win.pageYOffset:event.clientY};if(type.match(/DOMMouseScroll|mousewheel/)){var wheel=(event.wheelDelta)?event.wheelDelta/120:-(event.detail||0)/3;} -var rightClick=(event.which==3)||(event.button==2);var related=null;if(type.match(/over|out/)){switch(type){case'mouseover':related=event.relatedTarget||event.fromElement;break;case'mouseout':related=event.relatedTarget||event.toElement;} -if(!(function(){while(related&&related.nodeType==3)related=related.parentNode;return true;}).create({attempt:Browser.Engine.gecko})())related=false;}} -return $extend(this,{event:event,type:type,page:page,client:client,rightClick:rightClick,wheel:wheel,relatedTarget:related,target:target,code:code,key:key,shift:event.shiftKey,control:event.ctrlKey,alt:event.altKey,meta:event.metaKey});}});Event.Keys=new Hash({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});var Class=new Native({name:'Class',initialize:function(properties){properties=properties||{};var klass=function(){for(var key in this){if($type(this[key])!='function')this[key]=$unlink(this[key]);} -this.constructor=klass;if(Class.prototyping)return this;var instance=(this.initialize)?this.initialize.apply(this,arguments):this;if(this.options&&this.options.initialize)this.options.initialize.call(this);return instance;};for(var mutator in Class.Mutators){if(!properties[mutator])continue;properties=Class.Mutators[mutator](properties,properties[mutator]);delete properties[mutator];} -$extend(klass,this);klass.constructor=Class;klass.prototype=properties;return klass;}});Class.Mutators={Extends:function(self,klass){Class.prototyping=klass.prototype;var subclass=new klass;delete subclass.parent;subclass=Class.inherit(subclass,self);delete Class.prototyping;return subclass;},Implements:function(self,klasses){$splat(klasses).each(function(klass){Class.prototying=klass;$extend(self,($type(klass)=='class')?new klass:klass);delete Class.prototyping;});return self;}};Class.extend({inherit:function(object,properties){var caller=arguments.callee.caller;for(var key in properties){var override=properties[key];var previous=object[key];var type=$type(override);if(previous&&type=='function'){if(override!=previous){if(caller){override.__parent=previous;object[key]=override;}else{Class.override(object,key,override);}}}else if(type=='object'){object[key]=$merge(previous,override);}else{object[key]=override;}} -if(caller)object.parent=function(){return arguments.callee.caller.__parent.apply(this,arguments);};return object;},override:function(object,name,method){var parent=Class.prototyping;if(parent&&object[name]!=parent[name])parent=null;var override=function(){var previous=this.parent;this.parent=parent?parent[name]:object[name];var value=method.apply(this,arguments);this.parent=previous;return value;};object[name]=override;}});Class.implement({implement:function(){var proto=this.prototype;$each(arguments,function(properties){Class.inherit(proto,properties);});return this;}});var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(type,fn,internal){type=Events.removeOn(type);if(fn!=$empty){this.$events[type]=this.$events[type]||[];this.$events[type].include(fn);if(internal)fn.internal=true;} -return this;},addEvents:function(events){for(var type in events)this.addEvent(type,events[type]);return this;},fireEvent:function(type,args,delay){type=Events.removeOn(type);if(!this.$events||!this.$events[type])return this;this.$events[type].each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},removeEvent:function(type,fn){type=Events.removeOn(type);if(!this.$events[type])return this;if(!fn.internal)this.$events[type].erase(fn);return this;},removeEvents:function(events){if($type(events)=='object'){for(var type in events)this.removeEvent(type,events[type]);return this;} -if(events)events=Events.removeOn(events);for(var type in this.$events){if(events&&events!=type)continue;var f... [truncated message content] |
From: <jen...@us...> - 2009-05-27 10:51:53
|
Revision: 1774 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1774&view=rev Author: jenslehmann Date: 2009-05-27 10:51:47 +0000 (Wed, 27 May 2009) Log Message: ----------- minor change Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-27 10:03:32 UTC (rev 1773) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-27 10:51:47 UTC (rev 1774) @@ -366,7 +366,7 @@ queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary#name_int> ?name_int } ."; // filter out ways => we assume that it is always better to match a point and not a way // (if there is a way, there should also be a point but not vice versa) - queryStr += "FILTER (?point LIKE <http://linkedgeodata.org/triplify/node/%>) ."; +// queryStr += "FILTER (?point LIKE <http://linkedgeodata.org/triplify/node/%>) ."; queryStr += "}"; // SparqlQuery query = new SparqlQuery(queryStr, geoDataEndpoint); @@ -414,7 +414,10 @@ double distanceScore = Math.pow(frac-1,4); double score = 0.8 * stringSimilarity + 0.2 * distanceScore; -// if(qs.getResource("point").toString().contains("/way/"); + // if there is a node and a way, we prefer the node (better representative) + if(qs.getResource("point").toString().contains("/way/")) { + score -= 0.02; + } if(score > highestScore) { highestScore = score; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-27 10:03:39
|
Revision: 1773 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1773&view=rev Author: jenslehmann Date: 2009-05-27 10:03:32 +0000 (Wed, 27 May 2009) Log Message: ----------- fixed Protege plugin update problems Modified Paths: -------------- trunk/build.xml trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2009-05-27 09:53:20 UTC (rev 1772) +++ trunk/build.xml 2009-05-27 10:03:32 UTC (rev 1773) @@ -370,7 +370,8 @@ </copy> <javac srcdir="${source}" destdir="${temp}" - debug="on"> + debug="on" + target="1.5"> <classpath refid="classpath"/> </javac> <jar destfile="${release}/DL-Learner-protege-plugin.jar" manifest="${temp}/META-INF/MANIFEST.MF"> Modified: trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF 2009-05-27 09:53:20 UTC (rev 1772) +++ trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF 2009-05-27 10:03:32 UTC (rev 1773) @@ -3,12 +3,12 @@ Bundle-Name: DL-Learner Plugin Bundle-SymbolicName: org.dllearner.tools.protege;singleton:=true Bundle-Category: protege -Bundle-Description: blablabla -Bundle-Vendor: blablabla -Bundle-DocURL: blablabla +Bundle-Description: Protege DL-Learner Plugin +Bundle-Vendor: DL-Learner Project +Bundle-DocURL: http://dl-learner.org/wiki/ProtegePlugin Bundle-ClassPath: .,lib/junit-4.4.jar,lib/jamon-2.7.jar,lib/pellet/pellet-core.jar,lib/pellet/pellet-datatypes.jar,lib/pellet/pellet-el.jar,lib/pellet/pellet-explanation.jar,lib/pellet/pellet-owlapi.jar,lib/pellet/pellet-rules.jar,lib/pellet/aterm-java-1.6.jar,lib/jena/json.jar,lib/pellet/relaxngDatatype.jar,lib/pellet/xsdlib.jar,lib/jena/commons-logging-1.1.1.jar,lib/ore-tool/swingx-0.9.2.jar Import-Package: org.osgi.framework,org.apache.log4j Export-Package: lib -Bundle-Version: 1.0.0 +Bundle-Version: 0.5.2 Bundle-Activator: org.protege.editor.core.plugin.DefaultPluginActivator Require-Bundle: org.eclipse.equinox.registry,org.eclipse.equinox.common,org.protege.editor.core.application,org.protege.editor.owl,org.semanticweb.owl.owlapi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-27 09:53:32
|
Revision: 1772 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1772&view=rev Author: jenslehmann Date: 2009-05-27 09:53:20 +0000 (Wed, 27 May 2009) Log Message: ----------- matching refined further Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-05-26 14:22:14 UTC (rev 1771) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-05-27 09:53:20 UTC (rev 1772) @@ -458,7 +458,8 @@ Individual i = ((ObjectValueRestriction)description).getIndividual(); ObjectProperty op = (ObjectProperty) ((ObjectValueRestriction)description).getRestrictedPropertyExpression(); - return opPos.get(op).get(individual).contains(i); + Set<Individual> inds = opPos.get(op).get(individual); + return inds == null ? false : inds.contains(i); } else if (description instanceof BooleanValueRestriction) { DatatypeProperty dp = ((BooleanValueRestriction) description) .getRestrictedPropertyExpresssion(); Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-26 14:22:14 UTC (rev 1771) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-27 09:53:20 UTC (rev 1772) @@ -74,7 +74,8 @@ public static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointLOCALDBpedia(); private static SPARQLTasks dbpedia = new SPARQLTasks(new Cache("cache/dbpedia_file/"), dbpediaEndpoint); private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); - private static SPARQLTasks lgd = new SPARQLTasks(new Cache("cache/lgd/"), geoDataEndpoint); +// private static SPARQLTasks lgd = new SPARQLTasks(new Cache("cache/lgd/"), geoDataEndpoint); + private static SPARQLTasks lgd = new SPARQLTasks(geoDataEndpoint); private static Map<POIClass, Integer> noMatchPerClass = new HashMap<POIClass, Integer>(); private static Map<POIClass, Integer> matchPerClass = new HashMap<POIClass, Integer>(); @@ -363,6 +364,9 @@ queryStr += "?point <http://linkedgeodata.org/vocabulary#name> ?name ."; queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary#name%25en> ?name_en } ."; queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary#name_int> ?name_int } ."; + // filter out ways => we assume that it is always better to match a point and not a way + // (if there is a way, there should also be a point but not vice versa) + queryStr += "FILTER (?point LIKE <http://linkedgeodata.org/triplify/node/%>) ."; queryStr += "}"; // SparqlQuery query = new SparqlQuery(queryStr, geoDataEndpoint); @@ -410,6 +414,7 @@ double distanceScore = Math.pow(frac-1,4); double score = 0.8 * stringSimilarity + 0.2 * distanceScore; +// if(qs.getResource("point").toString().contains("/way/"); if(score > highestScore) { highestScore = score; Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-26 14:22:14 UTC (rev 1771) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-27 09:53:20 UTC (rev 1772) @@ -157,12 +157,22 @@ return POIClass.CITY; } else if(clazz.equals("http://dbpedia.org/ontology/Lake")) { return POIClass.LAKE; + } else if(clazz.equals("http://umbel.org/umbel/sc/Lake")) { + return POIClass.LAKE; } else if(clazz.equals("http://dbpedia.org/ontology/University")) { return POIClass.UNIVERSITY; } else if(clazz.equals("http://dbpedia.org/ontology/School")) { return POIClass.SCHOOL; + } else if(clazz.equals("http://umbel.org/umbel/sc/SchoolInstitution")) { + return POIClass.SCHOOL; + } else if(clazz.equals("http://umbel.org/umbel/sc/HighSchool")) { + return POIClass.SCHOOL; } else if(clazz.equals("http://dbpedia.org/ontology/Country")) { return POIClass.COUNTRY; + } else if(clazz.equals("http://umbel.org/umbel/sc/Country")) { + return POIClass.COUNTRY; + } else if(clazz.equals("http://umbel.org/umbel/sc/IndependentCountry")) { + return POIClass.COUNTRY; } else if(clazz.equals("http://dbpedia.org/ontology/Airport")) { return POIClass.AIRPORT; } else if(clazz.equals("http://umbel.org/umbel/sc/Airfield")) { @@ -171,18 +181,28 @@ return POIClass.RAILWAY_STATION; } else if(clazz.equals("http://dbpedia.org/ontology/Stadium")) { return POIClass.STADIUM; + } else if(clazz.equals("http://umbel.org/umbel/sc/Stadium")) { + return POIClass.STADIUM; } else if(clazz.equals("http://dbpedia.org/ontology/Island")) { return POIClass.ISLAND; } else if(clazz.equals("http://dbpedia.org/ontology/River")) { return POIClass.RIVER; + } else if(clazz.equals("http://umbel.org/umbel/sc/River")) { + return POIClass.RIVER; } else if(clazz.equals("http://dbpedia.org/ontology/Bridge")) { return POIClass.BRIDGE; + } else if(clazz.equals("http://umbel.org/umbel/sc/Bridge")) { + return POIClass.BRIDGE; } else if(clazz.equals("http://dbpedia.org/ontology/Mountain")) { return POIClass.MOUNTAIN; } else if(clazz.equals("http://umbel.org/umbel/sc/Mountain")) { return POIClass.MOUNTAIN; } else if(clazz.equals("http://dbpedia.org/ontology/Lighthouse")) { return POIClass.LIGHT_HOUSE; + } else if(clazz.equals("http://umbel.org/umbel/sc/Lighthouse")) { + return POIClass.LIGHT_HOUSE; + } else if(clazz.equals("http://dbpedia.org/ontology/RadioStation")) { + return POIClass.RADIO_STATION; } } return null; Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-26 14:22:14 UTC (rev 1771) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-27 09:53:20 UTC (rev 1772) @@ -86,6 +86,10 @@ // logger.trace("searching match for " + match.getKey() + "..."); + // we make the assumption that we always want to match against nodes + if(match.getValue().toString().contains("/way/")) + continue; + DBpediaPoint dbpediaPoint = null; try { dbpediaPoint = new DBpediaPoint(match.getKey()); Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-26 14:22:14 UTC (rev 1771) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-27 09:53:20 UTC (rev 1772) @@ -69,16 +69,17 @@ URI dbpediaURI = match.getKey(); URI lgdURI = match.getValue(); // test whether the dbpediaURI is a city - String query = "ASK {<"+dbpediaURI+"> a <http://dbpedia.org/ontology/City>}"; - boolean isCity = dbpedia.ask(query); - if(!isCity) { - // DBpedia ontology does not capture all cities, so we also use UMBEL, YAGO - String query2 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%City%>) }"; - String query3 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%Cities%>) }"; - isCity = dbpedia.ask(query2) || dbpedia.ask(query3); - } +// String query = "ASK {<"+dbpediaURI+"> a <http://dbpedia.org/ontology/City>}"; + String query = "ASK {<"+dbpediaURI+"> a <http://dbpedia.org/ontology/Organisation>}"; + boolean isInClass = dbpedia.ask(query); +// if(!isCity) { +// // DBpedia ontology does not capture all cities, so we also use UMBEL, YAGO +// String query2 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%City%>) }"; +// String query3 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%Cities%>) }"; +// isCity = dbpedia.ask(query2) || dbpedia.ask(query3); +// } // System.out.println(isCity + " " + lgdURI); - if(isCity) { + if(isInClass) { positives.add(lgdURI.toString()); System.out.println("+\""+lgdURI+"\""); } else { @@ -121,9 +122,9 @@ celoe.getConfigurator().setUseDoubleDatatypes(false); celoe.getConfigurator().setUseNegation(false); celoe.getConfigurator().setUseHasValueConstructor(true); - celoe.getConfigurator().setValueFrequencyThreshold(10); - celoe.getConfigurator().setMaxExecutionTimeInSeconds(1000); - celoe.getConfigurator().setNoisePercentage(0.1); + celoe.getConfigurator().setValueFrequencyThreshold(3); + celoe.getConfigurator().setMaxExecutionTimeInSeconds(100); + celoe.getConfigurator().setNoisePercentage(0.2); celoe.init(); // debugging This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-26 14:22:19
|
Revision: 1771 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1771&view=rev Author: jenslehmann Date: 2009-05-26 14:22:14 +0000 (Tue, 26 May 2009) Log Message: ----------- support for matching mountains, islands, stadiums, rivers, radio stations, lighthouses collection of stats Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-26 11:02:20 UTC (rev 1770) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-26 14:22:14 UTC (rev 1771) @@ -142,13 +142,15 @@ matches++; matchPerClass.put(poiClass, noMatchPerClass.get(poiClass)+1); } +// System.out.println(poiClass); counter++; if(counter % 1000 == 0) { // System.out.println(new Date().toString() + ": " + counter + " points processed. " + matches + " matches found. " + skipCount + " POIs skipped."); printSummary(); - } + } } else { +// System.out.println(dp.getUri() + " " + dp.getClasses()); skipCount++; } @@ -192,16 +194,17 @@ System.out.println("Summary at date " + new Date().toString()); for(POIClass poiClass : POIClass.values()) { - double per = matchPerClass.get(poiClass)/(double)(matchPerClass.get(poiClass)+noMatchPerClass.get(poiClass)); - System.out.println("POI class " + poiClass + ": " + matchPerClass.get(poiClass) + " matches found, " + df.format(per) + "% of DBpedia POIs matched" ); + int classTests = matchPerClass.get(poiClass)+noMatchPerClass.get(poiClass); + double per = classTests == 0 ? 0 : 100 * matchPerClass.get(poiClass)/(double)(classTests); + System.out.println("POI class " + poiClass + ": " + matchPerClass.get(poiClass) + " matches found, " + df.format(per) + "% match rate" ); } // System.out.println(""); System.out.println("Overall:"); - int total = skipCount + matches; - double skipFreq = skipCount/(double)total; - double countFreq = counter/(double)total; - double matchFreq = matches/(double)total; + int total = skipCount + counter; + double skipFreq = 100*skipCount/(double)total; + double countFreq = 100*counter/(double)total; + double matchFreq = 100*matches/(double)total; System.out.println(skipCount + " POIs skipped (cannot be assigned to a POI class) = " + df.format(skipFreq) + "%"); System.out.println(counter + " POIs processed = " + df.format(countFreq) + "%"); System.out.println(matches + " matches found = " + df.format(matchFreq) + "%"); Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-26 11:02:20 UTC (rev 1770) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-26 14:22:14 UTC (rev 1771) @@ -148,7 +148,7 @@ } // maps classes (in DBpedia ontology or otherwise) to supported POI classes - private POIClass getPOIClass(String[] classes) { + public static POIClass getPOIClass(String[] classes) { for(String clazz : classes) { // System.out.println("class: " + clazz); if(clazz.equals("http://dbpedia.org/ontology/City")) { @@ -169,6 +169,20 @@ return POIClass.AIRPORT; } else if(clazz.equals("http://dbpedia.org/ontology/Station")) { return POIClass.RAILWAY_STATION; + } else if(clazz.equals("http://dbpedia.org/ontology/Stadium")) { + return POIClass.STADIUM; + } else if(clazz.equals("http://dbpedia.org/ontology/Island")) { + return POIClass.ISLAND; + } else if(clazz.equals("http://dbpedia.org/ontology/River")) { + return POIClass.RIVER; + } else if(clazz.equals("http://dbpedia.org/ontology/Bridge")) { + return POIClass.BRIDGE; + } else if(clazz.equals("http://dbpedia.org/ontology/Mountain")) { + return POIClass.MOUNTAIN; + } else if(clazz.equals("http://umbel.org/umbel/sc/Mountain")) { + return POIClass.MOUNTAIN; + } else if(clazz.equals("http://dbpedia.org/ontology/Lighthouse")) { + return POIClass.LIGHT_HOUSE; } } return null; Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java 2009-05-26 11:02:20 UTC (rev 1770) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java 2009-05-26 14:22:14 UTC (rev 1771) @@ -58,6 +58,13 @@ case LAKE : return variable + " <http://linkedgeodata.org/vocabulary#natural> \"water\" . "; case COUNTRY : return variable + " <http://linkedgeodata.org/vocabulary#place> \"country\" . "; case RAILWAY_STATION : return variable + " <http://linkedgeodata.org/vocabulary#railway> \"station\" . "; + case ISLAND : return variable + " <http://linkedgeodata.org/vocabulary#place> \"island\" . "; + case STADIUM : return variable + " <http://linkedgeodata.org/vocabulary#leisure> \"stadium\" . "; + case RIVER : return variable + " <http://linkedgeodata.org/vocabulary#waterway> ?something . "; + case BRIDGE : return variable + " <http://linkedgeodata.org/vocabulary#bridge> ?something . "; + case MOUNTAIN : return variable + " <http://linkedgeodata.org/vocabulary#natural> \"peak\" . "; + case RADIO_STATION : return variable + " <http://linkedgeodata.org/vocabulary#amenity> \"studio\" . "; + case LIGHT_HOUSE : return variable + " <http://linkedgeodata.org/vocabulary#man_made> \"lighthouse\" . "; default: throw new Error("Cannot restrict."); } } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-26 11:02:20 UTC (rev 1770) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-26 14:22:14 UTC (rev 1771) @@ -47,6 +47,27 @@ // 200 km box (largest lake is the Caspian Sea with 1200 km length) LAKE (200000), + // 1 km box + BRIDGE (1000), + + // 10 km box + MOUNTAIN (10000), + + // 10000 km box (continents?) + ISLAND (10000000), + + // 1 km box + STADIUM (1000), + + // 1000 km box + RIVER (1000000), + + // 1 km box + RADIO_STATION (1000), + + // 1 km box + LIGHT_HOUSE (1000), + // 2000 km box (Russia has radius 4000 km) COUNTRY (2000000); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-26 11:02:27
|
Revision: 1770 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1770&view=rev Author: jenslehmann Date: 2009-05-26 11:02:20 +0000 (Tue, 26 May 2009) Log Message: ----------- added debug output Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-25 20:34:26 UTC (rev 1769) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-26 11:02:20 UTC (rev 1770) @@ -28,6 +28,7 @@ import java.net.URI; import java.net.URL; import java.net.URLConnection; +import java.text.DecimalFormat; import java.util.Collection; import java.util.Date; import java.util.HashMap; @@ -78,6 +79,11 @@ private static Map<POIClass, Integer> noMatchPerClass = new HashMap<POIClass, Integer>(); private static Map<POIClass, Integer> matchPerClass = new HashMap<POIClass, Integer>(); + private static DecimalFormat df = new DecimalFormat(); + private static int skipCount = 0; + private static int counter = 0; + private static int matches = 0; + // read in DBpedia ontology such that we perform taxonomy reasoning // private static ReasonerComponent reasoner = TestOntologies.getTestOntology(TestOntology.DBPEDIA_OWL); // private static ClassHierarchy hierarchy = reasoner.getClassHierarchy(); @@ -107,12 +113,9 @@ // read file point by point BufferedReader br = new BufferedReader(new FileReader(dbpediaFile)); String line; - int counter = 0; - int matches = 0; // temporary variables needed while reading in file int itemCount = 0; - int skipCount = 0; URI uri = null; String label = null; String[] classes = null; @@ -141,8 +144,9 @@ } counter++; - if(counter % 100 == 0) { - System.out.println(new Date().toString() + ": " + counter + " points processed. " + matches + " matches found. " + skipCount + " POIs skipped."); + if(counter % 1000 == 0) { +// System.out.println(new Date().toString() + ": " + counter + " points processed. " + matches + " matches found. " + skipCount + " POIs skipped."); + printSummary(); } } else { skipCount++; @@ -180,20 +184,27 @@ br.close(); fos.close(); + printSummary(); + System.out.println("Finished Successfully."); + } + + private static void printSummary() { + System.out.println("Summary at date " + new Date().toString()); - for(POIClass poiClass : POIClass.values()) { - System.out.println(); - System.out.println("summary for POI class " + poiClass + ":"); - System.out.println("matches " + matchPerClass.get(poiClass)); - System.out.println("no matches " + noMatchPerClass.get(poiClass)); + double per = matchPerClass.get(poiClass)/(double)(matchPerClass.get(poiClass)+noMatchPerClass.get(poiClass)); + System.out.println("POI class " + poiClass + ": " + matchPerClass.get(poiClass) + " matches found, " + df.format(per) + "% of DBpedia POIs matched" ); } - System.out.println(""); - System.out.println("Overall summary:"); - System.out.println(skipCount + " POIs skipped (no classification available)"); - System.out.println(counter + " POIs processed"); - System.out.println(matches + " matches found"); +// System.out.println(""); + System.out.println("Overall:"); + int total = skipCount + matches; + double skipFreq = skipCount/(double)total; + double countFreq = counter/(double)total; + double matchFreq = matches/(double)total; + System.out.println(skipCount + " POIs skipped (cannot be assigned to a POI class) = " + df.format(skipFreq) + "%"); + System.out.println(counter + " POIs processed = " + df.format(countFreq) + "%"); + System.out.println(matches + " matches found = " + df.format(matchFreq) + "%"); } // downloads information about DBpedia into a separate file Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-25 20:34:26 UTC (rev 1769) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-26 11:02:20 UTC (rev 1770) @@ -54,7 +54,7 @@ public class LearnOSMClasses { private static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointLOCALDBpedia(); - private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); +// private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); public static void main(String args[]) throws IOException, DataFormatException, LearningProblemUnsupportedException, ComponentInitException { File matchesFile = new File("log/geodata/owlsameas_en.dat"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-25 20:35:01
|
Revision: 1769 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1769&view=rev Author: jenslehmann Date: 2009-05-25 20:34:26 +0000 (Mon, 25 May 2009) Log Message: ----------- adjustments for full matching run Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-25 17:29:33 UTC (rev 1768) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-25 20:34:26 UTC (rev 1769) @@ -30,13 +30,15 @@ import java.net.URLConnection; import java.util.Collection; import java.util.Date; +import java.util.HashMap; import java.util.LinkedList; +import java.util.Map; +import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.dllearner.kb.sparql.Cache; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; -import org.dllearner.kb.sparql.SparqlQuery; import org.dllearner.utilities.Files; import com.hp.hpl.jena.query.QuerySolution; @@ -73,6 +75,9 @@ private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); private static SPARQLTasks lgd = new SPARQLTasks(new Cache("cache/lgd/"), geoDataEndpoint); + private static Map<POIClass, Integer> noMatchPerClass = new HashMap<POIClass, Integer>(); + private static Map<POIClass, Integer> matchPerClass = new HashMap<POIClass, Integer>(); + // read in DBpedia ontology such that we perform taxonomy reasoning // private static ReasonerComponent reasoner = TestOntologies.getTestOntology(TestOntology.DBPEDIA_OWL); // private static ClassHierarchy hierarchy = reasoner.getClassHierarchy(); @@ -83,11 +88,18 @@ public static void main(String[] args) throws IOException { + Logger.getRootLogger().setLevel(Level.WARN); + // download all objects having geo-coordinates from DBpedia if necessary if(!dbpediaFile.exists() || regenerateFile) { createDBpediaFile(); } + for(POIClass poiClass : POIClass.values()) { + matchPerClass.put(poiClass, 0); + noMatchPerClass.put(poiClass, 0); + } + Files.clearFile(matchingFile); Files.clearFile(missesFile); FileOutputStream fos = new FileOutputStream(matchingFile, true); @@ -100,6 +112,7 @@ // temporary variables needed while reading in file int itemCount = 0; + int skipCount = 0; URI uri = null; String label = null; String[] classes = null; @@ -111,23 +124,30 @@ if(line.isEmpty()) { DBpediaPoint dp = new DBpediaPoint(uri, label, classes, geoLat, geoLong, decimalCount); + POIClass poiClass = dp.getPoiClass(); - // find match (we assume there is exactly one match) - URI matchURI = findGeoDataMatch(dp); - if(matchURI == null) { - String missStr = dp.toString() + "\n"; - fosMiss.write(missStr.getBytes()); + if(poiClass != null) { + // find match (we assume there is exactly one match) + URI matchURI = findGeoDataMatch(dp); + if(matchURI == null) { + String missStr = dp.toString() + "\n"; + fosMiss.write(missStr.getBytes()); + noMatchPerClass.put(poiClass, noMatchPerClass.get(poiClass)+1); + } else { + String matchStr = "<" + dp.getUri() + "> <http://www.w3.org/2002/07/owl#sameAs> <" + matchURI + "> .\n"; + fos.write(matchStr.getBytes()); + matches++; + matchPerClass.put(poiClass, noMatchPerClass.get(poiClass)+1); + } + counter++; + + if(counter % 100 == 0) { + System.out.println(new Date().toString() + ": " + counter + " points processed. " + matches + " matches found. " + skipCount + " POIs skipped."); + } } else { - String matchStr = "<" + dp.getUri() + "> <http://www.w3.org/2002/07/owl#sameAs> <" + matchURI + "> .\n"; - fos.write(matchStr.getBytes()); - matches++; + skipCount++; } - counter++; - if(counter % 1000 == 0) { - System.out.println(new Date().toString() + ": " + counter + " points processed. " + matches + " matches found."); - } - itemCount = 0; } else { switch(itemCount) { @@ -159,6 +179,21 @@ } br.close(); fos.close(); + + + + for(POIClass poiClass : POIClass.values()) { + System.out.println(); + System.out.println("summary for POI class " + poiClass + ":"); + System.out.println("matches " + matchPerClass.get(poiClass)); + System.out.println("no matches " + noMatchPerClass.get(poiClass)); + } + + System.out.println(""); + System.out.println("Overall summary:"); + System.out.println(skipCount + " POIs skipped (no classification available)"); + System.out.println(counter + " POIs processed"); + System.out.println(matches + " matches found"); } // downloads information about DBpedia into a separate file Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-25 17:29:33 UTC (rev 1768) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-25 20:34:26 UTC (rev 1769) @@ -44,11 +44,11 @@ RAILWAY_STATION (10000), - // 1000 km box - LAKE (1000000000), + // 200 km box (largest lake is the Caspian Sea with 1200 km length) + LAKE (200000), - // 5000 km box - COUNTRY (5000000); + // 2000 km box (Russia has radius 4000 km) + COUNTRY (2000000); private double maxBox; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-25 17:29:46
|
Revision: 1768 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1768&view=rev Author: jenslehmann Date: 2009-05-25 17:29:33 +0000 (Mon, 25 May 2009) Log Message: ----------- combined distance and string metrics Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-25 16:15:37 UTC (rev 1767) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-25 17:29:33 UTC (rev 1768) @@ -62,13 +62,14 @@ private static File matchingFile = new File("log/DBpedia_GeoData_Links.nt"); private static File missesFile = new File("log/DBpedia_GeoData_Misses.dat"); - private static double scoreThreshold = 0.9; + private static double scoreThreshold = 0.85; private static StringDistance distance = new Jaro(); private static String usedDatatype = "xsd:decimal"; // public static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointDBpedia(); public static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointLOCALDBpedia(); + private static SPARQLTasks dbpedia = new SPARQLTasks(new Cache("cache/dbpedia_file/"), dbpediaEndpoint); private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); private static SPARQLTasks lgd = new SPARQLTasks(new Cache("cache/lgd/"), geoDataEndpoint); @@ -181,12 +182,13 @@ queryStr += "?object rdfs:label ?label . "; queryStr += "OPTIONAL { ?object rdf:type ?type . "; queryStr += "FILTER (!(?type LIKE <http://dbpedia.org/ontology/Resource>)) ."; - queryStr += "FILTER (?type LIKE <http://dbpedia.org/ontology/%>) ."; + queryStr += "FILTER (?type LIKE <http://dbpedia.org/ontology/%> || ?type LIKE <http://umbel.org/umbel/sc/%>) ."; queryStr += "} }"; queryStr += "LIMIT " + limit + " OFFSET " + offset; - SparqlQuery query = new SparqlQuery(queryStr, dbpediaEndpoint); - ResultSet rs = query.send(); +// SparqlQuery query = new SparqlQuery(queryStr, dbpediaEndpoint); +// ResultSet rs = query.send(); + ResultSet rs = dbpedia.queryAsResultSet(queryStr); String previousObject = null; String geoLat = ""; String geoLong = ""; @@ -352,9 +354,13 @@ } // step 2: spatial distance - // ... not yet taken into account ... see spatialDistance() method below + double lat = qs.getLiteral("lat").getDouble(); + double lon = qs.getLiteral("long").getDouble(); + double distance = spatialDistance(dbpediaPoint.getGeoLat(), dbpediaPoint.getGeoLong(), lat, lon); + double frac = distance / dbpediaPoint.getPoiClass().getMaxBox(); + double distanceScore = Math.pow(frac-1,4); - double score = stringSimilarity; + double score = 0.8 * stringSimilarity + 0.2 * distanceScore; if(score > highestScore) { highestScore = score; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-25 16:15:44
|
Revision: 1767 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1767&view=rev Author: jenslehmann Date: 2009-05-25 16:15:37 +0000 (Mon, 25 May 2009) Log Message: ----------- extended DBpedia->LGD matching to cover 7 different POI types Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-05-22 13:47:11 UTC (rev 1766) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-05-25 16:15:37 UTC (rev 1767) @@ -52,7 +52,7 @@ * the Endpoint the sparql queries will be send to */ public SPARQLTasks(final SparqlEndpoint sparqlEndpoint) { - super(); +// super(); this.cache = null; this.sparqlEndpoint = sparqlEndpoint; } @@ -64,7 +64,7 @@ * the Endpoint the sparql queries will be send to */ public SPARQLTasks(final Cache cache, final SparqlEndpoint sparqlEndpoint) { - super(); +// super(); this.cache = cache; this.sparqlEndpoint = sparqlEndpoint; } @@ -472,7 +472,6 @@ /** * low level, executes query returns ResultSet. - * TODO: Why convert from result set to JSON and back? See method below. * * @param sparqlQueryString * The query @@ -480,7 +479,13 @@ */ public ResultSetRewindable queryAsResultSet(String sparqlQueryString) { SparqlQuery sq = new SparqlQuery(sparqlQueryString, sparqlEndpoint); - return sq.send(); + if(cache == null) { + return sq.send(); + } else { + // get JSON from cache and convert to result set + String json = cache.executeSparqlQuery(sq); + return SparqlQuery.convertJSONtoResultSet(json); + } } /** Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-22 13:47:11 UTC (rev 1766) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-25 16:15:37 UTC (rev 1767) @@ -70,7 +70,7 @@ // public static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointDBpedia(); public static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointLOCALDBpedia(); private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); - private static SPARQLTasks lgd = new SPARQLTasks(new Cache("cache/matcher/"), geoDataEndpoint); + private static SPARQLTasks lgd = new SPARQLTasks(new Cache("cache/lgd/"), geoDataEndpoint); // read in DBpedia ontology such that we perform taxonomy reasoning // private static ReasonerComponent reasoner = TestOntologies.getTestOntology(TestOntology.DBPEDIA_OWL); @@ -266,27 +266,39 @@ fos.close(); } + /** + * The main matching method. The matching is directed from DBpedia to LGD, + * i.e. given a POI in DBpedia, we try to find a match in LGD. + * + * @param dbpediaPoint The DBpedia point. + * @return The URI of the matched LGD point or null if no match was found. + * @throws IOException Thrown if a query or linked data access does not work. + */ public static URI findGeoDataMatch(DBpediaPoint dbpediaPoint) throws IOException { // 1 degree is about 111 km (depending on the specific point) - int distanceThresholdMeters = 1000; + double distanceThresholdMeters = dbpediaPoint.getPoiClass().getMaxBox(); boolean quiet = true; if(useSparqlForGettingNearbyPoints) { - // TODO: convert from meters to lat/long - double distanceThresholdLat = 0.5; - double distanceThresholdLong = 0.5; - - // Triplify: $1= , $2= , $3 = distance in meters + // deprecated: direct specification of long/lat difference +// double distanceThresholdLat = 0.5; +// double distanceThresholdLong = 0.5; + // create a box around the point +// double minLat2 = dbpediaPoint.getGeoLat() - distanceThresholdLat; +// double maxLat2 = dbpediaPoint.getGeoLat() + distanceThresholdLat; +// double minLong2 = dbpediaPoint.getGeoLong() - distanceThresholdLong; +// double maxLong2 = dbpediaPoint.getGeoLong() + distanceThresholdLong; + + // Triplify: $1 = latitude, $2 = longitude, $3 = distance in meters + // LGD uses integer for lat/long (standard values multiplied by 10000000) // $box='longitude between CEIL(($2-($3/1000)/abs(cos(radians($1))*111))*10000000) and CEIL(($2+($3/1000)/abs(cos(radians($1))*111))*10000000) // AND latitude between CEIL(($1-($3/1000/111))*10000000) and CEIL(($1+($3/1000/111))*10000000)'; - // create a box around the point - double minLat = dbpediaPoint.getGeoLat() - distanceThresholdLat; - double maxLat = dbpediaPoint.getGeoLat() + distanceThresholdLat; - double minLong = dbpediaPoint.getGeoLong() - distanceThresholdLong; - double maxLong = dbpediaPoint.getGeoLong() + distanceThresholdLong; - + double minLat = dbpediaPoint.getGeoLat()-(distanceThresholdMeters/1000/111); + double maxLat = dbpediaPoint.getGeoLat()+(distanceThresholdMeters/1000/111); + double minLong = dbpediaPoint.getGeoLong()-(distanceThresholdMeters/1000)/Math.abs(Math.cos(Math.toRadians(dbpediaPoint.getGeoLat()))*111); + double maxLong = dbpediaPoint.getGeoLong()+(distanceThresholdMeters/1000)/Math.abs(Math.cos(Math.toRadians(dbpediaPoint.getGeoLat()))*111); // query all points in the box corresponding to this class // (we make sure that returned points are in the same POI class) String queryStr = "select ?point ?lat ?long ?name ?name_en ?name_int where { "; Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-22 13:47:11 UTC (rev 1766) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-25 16:15:37 UTC (rev 1767) @@ -68,7 +68,7 @@ queryStr += "<"+uri+"> rdfs:label ?label . "; queryStr += "OPTIONAL { <"+uri+"> rdf:type ?type . "; queryStr += "FILTER (!(?type LIKE <http://dbpedia.org/ontology/Resource>)) ."; - queryStr += "FILTER (?type LIKE <http://dbpedia.org/ontology/%>) ."; + queryStr += "FILTER (?type LIKE <http://dbpedia.org/ontology/%> || ?type LIKE <http://umbel.org/umbel/sc/%>) ."; queryStr += "} }"; // SparqlQuery query = new SparqlQuery(queryStr, DBpediaLinkedGeoData.dbpediaEndpoint); @@ -147,10 +147,28 @@ return str + ")"; } + // maps classes (in DBpedia ontology or otherwise) to supported POI classes private POIClass getPOIClass(String[] classes) { for(String clazz : classes) { +// System.out.println("class: " + clazz); if(clazz.equals("http://dbpedia.org/ontology/City")) { return POIClass.CITY; + } if(clazz.equals("http://umbel.org/umbel/sc/City")) { + return POIClass.CITY; + } else if(clazz.equals("http://dbpedia.org/ontology/Lake")) { + return POIClass.LAKE; + } else if(clazz.equals("http://dbpedia.org/ontology/University")) { + return POIClass.UNIVERSITY; + } else if(clazz.equals("http://dbpedia.org/ontology/School")) { + return POIClass.SCHOOL; + } else if(clazz.equals("http://dbpedia.org/ontology/Country")) { + return POIClass.COUNTRY; + } else if(clazz.equals("http://dbpedia.org/ontology/Airport")) { + return POIClass.AIRPORT; + } else if(clazz.equals("http://umbel.org/umbel/sc/Airfield")) { + return POIClass.AIRPORT; + } else if(clazz.equals("http://dbpedia.org/ontology/Station")) { + return POIClass.RAILWAY_STATION; } } return null; Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-22 13:47:11 UTC (rev 1766) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-25 16:15:37 UTC (rev 1767) @@ -22,6 +22,8 @@ import java.io.File; import java.io.IOException; import java.net.URI; +import java.util.Date; +import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.zip.DataFormatException; @@ -47,6 +49,11 @@ private double precision; private double recall; + private Map<POIClass, Integer> testsPerClass = new HashMap<POIClass, Integer>(); + private Map<POIClass, Integer> noMatchPerClass = new HashMap<POIClass, Integer>(); + private Map<POIClass, Integer> correctMatchPerClass = new HashMap<POIClass, Integer>(); + private Map<POIClass, Integer> incorrectMatchPerClass = new HashMap<POIClass, Integer>(); + private static Logger logger = Logger.getLogger(Evaluation.class); // map from DBpedia to LinkedGeoData @@ -58,6 +65,14 @@ correctMatchCount = 0; incorrectMatchCount = 0; + // init counts + for(POIClass poiClass : POIClass.values()) { + testsPerClass.put(poiClass, 0); + noMatchPerClass.put(poiClass, 0); + correctMatchPerClass.put(poiClass, 0); + incorrectMatchPerClass.put(poiClass, 0); + } + for(Entry<URI,URI> match : testMatches.entrySet()) { // find point in DBpedia file: // approach 1: @@ -82,12 +97,16 @@ URI matchedURI = null; - if(dbpediaPoint.getPoiClass() == POIClass.CITY) { - logger.info("Eval: searching match for " + match.getKey() + "..."); + if(dbpediaPoint.getPoiClass() == null) { + if(dbpediaPoint.getClasses().length == 0) { + System.out.println("skipping " + dbpediaPoint.getUri() + " (unknown POI type)"); + } else { + System.out.println("skipping " + dbpediaPoint.getUri() + " (unsupported POI type)"); + } + continue; + } else { + logger.info("Eval: searching match for " + match.getKey() + "(" + dbpediaPoint.getPoiClass() + ") ..."); matchedURI = DBpediaLinkedGeoData.findGeoDataMatch(dbpediaPoint); - } else { - System.out.println("skipping " + dbpediaPoint.getUri() + " (not detected as a city)"); - continue; } URI testURI = match.getValue(); @@ -95,18 +114,22 @@ // no match found if(matchedURI == null) { noMatchCount++; + inc(noMatchPerClass, dbpediaPoint.getPoiClass()); logger.info("Eval: ... no match found"); // correct match found } else if(matchedURI.equals(testURI)) { correctMatchCount++; + inc(correctMatchPerClass, dbpediaPoint.getPoiClass()); logger.info("Eval: ... " + testURI + " correctly detected"); // incorrect match found } else { incorrectMatchCount++; + inc(incorrectMatchPerClass, dbpediaPoint.getPoiClass()); logger.info("Eval: ... " + matchedURI + " detected, but " + testURI + " is correct"); } tests++; + inc(testsPerClass, dbpediaPoint.getPoiClass()); } matchCount = correctMatchCount + incorrectMatchCount; @@ -148,6 +171,50 @@ return discarded; } + private void inc(Map<POIClass,Integer> map, POIClass poiClass) { +// if(map.containsKey(poiClass)) { + map.put(poiClass, map.get(poiClass)+1); +// } else { +// map.put(poiClass, 1); +// } + } + + public Integer getCorrectMatchPerClass(POIClass poiClass) { + return correctMatchPerClass.get(poiClass); + } + + public Integer getIncorrectMatchPerClass(POIClass poiClass) { + return incorrectMatchPerClass.get(poiClass); + } + + public Integer getTestsPerClass(POIClass poiClass) { + return testsPerClass.get(poiClass); + } + + public Integer getMatchPerClass(POIClass poiClass) { + return incorrectMatchPerClass.get(poiClass) + correctMatchPerClass.get(poiClass); + } + + public Integer getNoMatchPerClass(POIClass poiClass) { + return noMatchPerClass.get(poiClass); + } + + public double getPrecisionPerClass(POIClass poiClass) { + if(getMatchPerClass(poiClass) == 0) { + return 0; + } else { + return correctMatchPerClass.get(poiClass) / (double) getMatchPerClass(poiClass); + } + } + + public double getRecallPerClass(POIClass poiClass) { + if(testsPerClass.get(poiClass) == 0) { + return 0; + } else { + return correctMatchPerClass.get(poiClass) / (double) testsPerClass.get(poiClass); + } + } + public static void main(String args[]) throws IOException, DataFormatException { Logger.getRootLogger().setLevel(Level.INFO); @@ -156,10 +223,24 @@ // map for collecting matches Map<URI,URI> matches = Utility.getMatches(testFile); // perform evaluation and print results + System.out.println(new Date()); Evaluation eval = new Evaluation(matches); + System.out.println(new Date()); + + for(POIClass poiClass : POIClass.values()) { + System.out.println(); + System.out.println("summary for POI class " + poiClass + ":"); + System.out.println(eval.getTestsPerClass(poiClass) + " points tested"); + System.out.println("precision: " + eval.getPrecisionPerClass(poiClass) + " (" + eval.getCorrectMatchPerClass(poiClass) + "/" + eval.getMatchPerClass(poiClass) + ")"); + System.out.println("recall: " + eval.getRecallPerClass(poiClass) + " (" + eval.getCorrectMatchPerClass(poiClass) + "/" + eval.getTestsPerClass(poiClass) + ")"); + } + + System.out.println(""); + System.out.println("Overall summary:"); System.out.println(eval.getTests() + " points tested (" + eval.getDiscarded() + " discarded)"); System.out.println("precision: " + eval.getPrecision() + " (" + eval.getCorrectMatchCount() + "/" + eval.getMatchCount() + ")"); System.out.println("recall: " + eval.getRecall() + " (" + eval.getCorrectMatchCount() + "/" + eval.getTests() + ")"); + } } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java 2009-05-22 13:47:11 UTC (rev 1766) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java 2009-05-25 16:15:37 UTC (rev 1767) @@ -52,6 +52,12 @@ public static String getSPARQLRestriction(POIClass poiClass, String variable) { switch(poiClass) { case CITY : return "{ " + variable + " <http://linkedgeodata.org/vocabulary#place> \"city\" } UNION {" + variable + " <http://linkedgeodata.org/vocabulary#place> \"village\" } UNION {" + variable + " <http://linkedgeodata.org/vocabulary#place> \"town\" } UNION {" + variable + " <http://linkedgeodata.org/vocabulary#place> \"suburb\" }"; + case UNIVERSITY : return variable + " <http://linkedgeodata.org/vocabulary#amenity> \"university\" . "; + case SCHOOL : return variable + " <http://linkedgeodata.org/vocabulary#amenity> \"school\" . "; + case AIRPORT : return variable + " <http://linkedgeodata.org/vocabulary#aeroway> \"aerodrome\" . "; + case LAKE : return variable + " <http://linkedgeodata.org/vocabulary#natural> \"water\" . "; + case COUNTRY : return variable + " <http://linkedgeodata.org/vocabulary#place> \"country\" . "; + case RAILWAY_STATION : return variable + " <http://linkedgeodata.org/vocabulary#railway> \"station\" . "; default: throw new Error("Cannot restrict."); } } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-22 13:47:11 UTC (rev 1766) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-25 16:15:37 UTC (rev 1767) @@ -28,6 +28,44 @@ */ public enum POIClass { - CITY, COUNTRY + // 50 km box + CITY (50000), + // 5 km box + AIRPORT (5000), + + // 10 km box + UNIVERSITY (10000), + + // 10 km box - usage unclear +// MUNICIPALITY (10000), + + SCHOOL (10000), + + RAILWAY_STATION (10000), + + // 1000 km box + LAKE (1000000000), + + // 5000 km box + COUNTRY (5000000); + + private double maxBox; + + POIClass(double maxBox) { + this.maxBox = maxBox; + } + + /** + * Maximum distance coordinates and actual position of + * this POI type can differ in meters. Retrieving POIs within + * the box specified by this distance should always contain + * the POI itself. + * + * @return The distance in meters different typical POIs for this + * type can differ. + */ + public double getMaxBox() { + return maxBox; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-22 14:14:39
|
Revision: 1766 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1766&view=rev Author: jenslehmann Date: 2009-05-22 13:47:11 +0000 (Fri, 22 May 2009) Log Message: ----------- DBpedia->LGD city matching Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -28,7 +28,6 @@ import org.dllearner.utilities.datastructures.StringTuple; import org.dllearner.utilities.owl.OWLVocabulary; -import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.ResultSetFactory; import com.hp.hpl.jena.query.ResultSetFormatter; Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -28,10 +28,8 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasonerComponent; -import org.dllearner.core.configurators.PosNegLPStandardConfigurator; import org.dllearner.core.configurators.PosOnlyLPConfigurator; import org.dllearner.core.options.CommonConfigMappings; import org.dllearner.core.options.ConfigEntry; Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -172,6 +172,7 @@ private boolean useNegation = true; private boolean useBooleanDatatypes = true; private boolean useDoubleDatatypes = true; + @SuppressWarnings("unused") private boolean useStringDatatypes = false; private boolean disjointChecks = true; private boolean instanceBasedDisjoints = true; Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -32,6 +32,9 @@ import java.util.Date; import java.util.LinkedList; +import org.apache.log4j.Logger; +import org.dllearner.kb.sparql.Cache; +import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlQuery; import org.dllearner.utilities.Files; @@ -50,6 +53,8 @@ */ public class DBpediaLinkedGeoData { + private static Logger logger = Logger.getLogger(DBpediaLinkedGeoData.class); + // chose between nt and dat private static String dbpediaFileFormat = "dat"; static File dbpediaFile = new File("log/DBpedia_POIs." + dbpediaFileFormat); @@ -57,12 +62,15 @@ private static File matchingFile = new File("log/DBpedia_GeoData_Links.nt"); private static File missesFile = new File("log/DBpedia_GeoData_Misses.dat"); - private static double scoreThreshold = 0.8; + private static double scoreThreshold = 0.9; private static StringDistance distance = new Jaro(); + private static String usedDatatype = "xsd:decimal"; + // public static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointDBpedia(); public static SparqlEndpoint dbpediaEndpoint = SparqlEndpoint.getEndpointLOCALDBpedia(); private static SparqlEndpoint geoDataEndpoint = SparqlEndpoint.getEndpointLOCALGeoData(); + private static SPARQLTasks lgd = new SPARQLTasks(new Cache("cache/matcher/"), geoDataEndpoint); // read in DBpedia ontology such that we perform taxonomy reasoning // private static ReasonerComponent reasoner = TestOntologies.getTestOntology(TestOntology.DBPEDIA_OWL); @@ -283,19 +291,20 @@ // (we make sure that returned points are in the same POI class) String queryStr = "select ?point ?lat ?long ?name ?name_en ?name_int where { "; queryStr += LGDPoint.getSPARQLRestriction(dbpediaPoint.getPoiClass(), "?point"); - queryStr += "?point <http://linkedgeodata.org/vocabulary/latitude> ?lat ."; - queryStr += "FILTER (xsd:float(?lat) > " + minLat + ") ."; - queryStr += "FILTER (xsd:float(?lat) < " + maxLat + ") ."; - queryStr += "?point <http://linkedgeodata.org/vocabulary/longitude> ?long ."; - queryStr += "FILTER (xsd:float(?long) > " + minLong + ") ."; - queryStr += "FILTER (xsd:float(?long) < " + maxLong + ") ."; - queryStr += "?point <http://linkedgeodata.org/vocabulary/name> ?name ."; - queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary/name%25en> ?name_en } ."; - queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary/name_int> ?name_int } ."; + queryStr += "?point <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat ."; + queryStr += "FILTER ("+usedDatatype+"(?lat) > " + minLat + ") ."; + queryStr += "FILTER ("+usedDatatype+"(?lat) < " + maxLat + ") ."; + queryStr += "?point <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long ."; + queryStr += "FILTER ("+usedDatatype+"(?long) > " + minLong + ") ."; + queryStr += "FILTER ("+usedDatatype+"(?long) < " + maxLong + ") ."; + queryStr += "?point <http://linkedgeodata.org/vocabulary#name> ?name ."; + queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary#name%25en> ?name_en } ."; + queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary#name_int> ?name_int } ."; queryStr += "}"; - SparqlQuery query = new SparqlQuery(queryStr, geoDataEndpoint); - ResultSet rs = query.send(); +// SparqlQuery query = new SparqlQuery(queryStr, geoDataEndpoint); +// ResultSet rs = query.send(); + ResultSet rs = lgd.queryAsResultSet(queryStr); double highestScore = 0; String bestURI = null; @@ -312,6 +321,10 @@ // from LGD we take name, name%25en, name, int_name String dbpediaLabel1 = dbpediaPoint.getLabel(); String dbpediaLabel2 = dbpediaPoint.getPlainLabel(); + +// System.out.println("label 1: " + dbpediaLabel1); +// System.out.println("label 2: " + dbpediaLabel2); + String lgdLabel1 = qs.getLiteral("name").toString(); stringSimilarity = distance.score(dbpediaLabel1, lgdLabel1); stringSimilarity = Math.max(distance.score(dbpediaLabel2, lgdLabel1), stringSimilarity); @@ -340,10 +353,10 @@ } if(highestScore > scoreThreshold) { - System.out.println("Match: " + highestScore + " " + bestLabel + " (" + bestURI + ")"); + logger.info("Match: " + highestScore + " " + bestLabel + " (" + dbpediaPoint.getUri() + " --> " + bestURI + ")"); return URI.create(bestURI); } else { - System.out.println("No match: " + highestScore + " " + bestLabel + " (" + bestURI + ")"); + logger.info("No match: " + highestScore + " " + bestLabel + " (" + dbpediaPoint.getUri() + " --/-> " + bestURI + ")"); return null; } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -25,7 +25,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.dllearner.kb.sparql.SparqlQuery; +import org.dllearner.kb.sparql.Cache; +import org.dllearner.kb.sparql.SPARQLTasks; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; @@ -46,8 +47,12 @@ // number of decimals indicates a large object) private int decimalCount; - Pattern pattern = Pattern.compile("\\w+"); + // all word symbols + space + Pattern pattern = Pattern.compile("[\\w| ]+"); + // use a cache such that DBpedia points can be quickly constructed from URIs + private static SPARQLTasks st = new SPARQLTasks(new Cache("cache/dbpedia_points/"), DBpediaLinkedGeoData.dbpediaEndpoint); + /** * Constructs a DBpedia point using SPARQL. * @param uri URI of DBpedia resource. @@ -66,8 +71,9 @@ queryStr += "FILTER (?type LIKE <http://dbpedia.org/ontology/%>) ."; queryStr += "} }"; - SparqlQuery query = new SparqlQuery(queryStr, DBpediaLinkedGeoData.dbpediaEndpoint); - ResultSet rs = query.send(); +// SparqlQuery query = new SparqlQuery(queryStr, DBpediaLinkedGeoData.dbpediaEndpoint); + ResultSet rs = st.queryAsResultSet(queryStr); +// ResultSet rs = query.send(); classes = new String[] { }; List<String> classList = new LinkedList<String>(); Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -19,12 +19,9 @@ */ package org.dllearner.scripts.matching; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.IOException; import java.net.URI; -import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.zip.DataFormatException; @@ -86,10 +83,10 @@ URI matchedURI = null; if(dbpediaPoint.getPoiClass() == POIClass.CITY) { - logger.trace("searching match for " + match.getKey() + "..."); + logger.info("Eval: searching match for " + match.getKey() + "..."); matchedURI = DBpediaLinkedGeoData.findGeoDataMatch(dbpediaPoint); } else { - System.out.println("skipping"); + System.out.println("skipping " + dbpediaPoint.getUri() + " (not detected as a city)"); continue; } @@ -98,15 +95,15 @@ // no match found if(matchedURI == null) { noMatchCount++; - logger.trace(" ... no match found"); + logger.info("Eval: ... no match found"); // correct match found } else if(matchedURI.equals(testURI)) { correctMatchCount++; - logger.trace(" ... " + testURI + " correctly detected"); + logger.info("Eval: ... " + testURI + " correctly detected"); // incorrect match found } else { incorrectMatchCount++; - logger.trace(" ... " + matchedURI + " detected, but " + testURI + " is correct"); + logger.info("Eval: ... " + matchedURI + " detected, but " + testURI + " is correct"); } tests++; @@ -153,7 +150,7 @@ public static void main(String args[]) throws IOException, DataFormatException { - Logger.getRootLogger().setLevel(Level.TRACE); + Logger.getRootLogger().setLevel(Level.INFO); // test file File testFile = new File("log/geodata/owlsameas_en.dat"); // map for collecting matches @@ -161,8 +158,8 @@ // perform evaluation and print results Evaluation eval = new Evaluation(matches); System.out.println(eval.getTests() + " points tested (" + eval.getDiscarded() + " discarded)"); - System.out.println("precision: " + eval.getPrecision()); - System.out.println("recall: " + eval.getRecall()); + System.out.println("precision: " + eval.getPrecision() + " (" + eval.getCorrectMatchCount() + "/" + eval.getMatchCount() + ")"); + System.out.println("recall: " + eval.getRecall() + " (" + eval.getCorrectMatchCount() + "/" + eval.getTests() + ")"); } } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -51,7 +51,7 @@ public static String getSPARQLRestriction(POIClass poiClass, String variable) { switch(poiClass) { - case CITY : return variable + " <http://linkedgeodata.org/vocabulary#amenity> \"city\" ."; + case CITY : return "{ " + variable + " <http://linkedgeodata.org/vocabulary#place> \"city\" } UNION {" + variable + " <http://linkedgeodata.org/vocabulary#place> \"village\" } UNION {" + variable + " <http://linkedgeodata.org/vocabulary#place> \"town\" } UNION {" + variable + " <http://linkedgeodata.org/vocabulary#place> \"suburb\" }"; default: throw new Error("Cannot restrict."); } } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-21 08:46:28 UTC (rev 1765) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-22 13:47:11 UTC (rev 1766) @@ -29,17 +29,10 @@ import java.util.zip.DataFormatException; import org.dllearner.algorithms.celoe.CELOE; -import org.dllearner.algorithms.refinement2.ROLComponent2; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; -import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.NamedClass; -import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.ObjectValueRestriction; -import org.dllearner.core.owl.Union; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.kb.manipulator.StringToResource; import org.dllearner.kb.manipulator.Rule.Months; @@ -47,7 +40,6 @@ import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlKnowledgeSource; -import org.dllearner.learningproblems.EvaluatedDescriptionPosOnly; import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.reasoning.FastInstanceChecker; @@ -79,6 +71,12 @@ // test whether the dbpediaURI is a city String query = "ASK {<"+dbpediaURI+"> a <http://dbpedia.org/ontology/City>}"; boolean isCity = dbpedia.ask(query); + if(!isCity) { + // DBpedia ontology does not capture all cities, so we also use UMBEL, YAGO + String query2 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%City%>) }"; + String query3 = "ASK {<"+dbpediaURI+"> a ?x . FILTER(?x LIKE <%Cities%>) }"; + isCity = dbpedia.ask(query2) || dbpedia.ask(query3); + } // System.out.println(isCity + " " + lgdURI); if(isCity) { positives.add(lgdURI.toString()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-21 08:46:45
|
Revision: 1765 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1765&view=rev Author: jenslehmann Date: 2009-05-21 08:46:28 +0000 (Thu, 21 May 2009) Log Message: ----------- several smaller changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RefinementOperatorConfigurator.java trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosNeg.java trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosOnly.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java trunk/src/dl-learner/org/dllearner/learningproblems/ScorePosOnly.java trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -569,6 +569,8 @@ // inc. minimum since we found no other node which also has min. horiz. exp. minHorizExp++; + +// System.out.println("minimum horizontal expansion is now " + minHorizExp); } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -199,6 +199,7 @@ options.add(CommonConfigOptions.useNegation()); options.add(CommonConfigOptions.useBooleanDatatypes()); options.add(CommonConfigOptions.useDoubleDatatypes()); + options.add(CommonConfigOptions.useStringDatatypes()); options.add(CommonConfigOptions.maxExecutionTimeInSeconds()); options.add(CommonConfigOptions.minExecutionTimeInSeconds()); options.add(CommonConfigOptions.guaranteeXgoodDescriptions()); Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -133,7 +133,7 @@ if (args.length > 1 && args[0].equals("-q")) { inQueryMode = true; } - + // create loggers (a simple logger which outputs // its messages to the console and a log file) @@ -205,7 +205,9 @@ e.printStackTrace(); System.exit(0); } + start.start(inQueryMode); + // write JaMON report in HTML file File jamonlog = new File("log/jamon.html"); Files.createFile(jamonlog, MonitorFactory.getReport()); @@ -843,7 +845,8 @@ } while (!(queryStr.equalsIgnoreCase("q") || queryStr.equalsIgnoreCase("quit"))); } - + + /** * error handling over the logger * Modified: trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -183,4 +183,13 @@ */ public SortedSet<Individual> getFalseDatatypeMembers(DatatypeProperty datatypeProperty); + /** + * Convenience method, which can be used which returns the property values as + * strings (note that any literal can be represented as string, even numbers). + * @see #getDatatypeMembers(DatatypeProperty) + * @param datatypeProperty A data property. + * @return The mapping between individuals and string values through the given property. + */ + public Map<Individual, SortedSet<String>> getStringDatatypeMembers(DatatypeProperty datatypeProperty); + } Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -661,6 +661,32 @@ } @Override + public final Map<Individual, SortedSet<String>> getStringDatatypeMembers( + DatatypeProperty datatypeProperty) { + try { + return getStringDatatypeMembersImpl(datatypeProperty); + } catch (ReasoningMethodUnsupportedException e) { + handleExceptions(e); + return null; + } + } + + protected Map<Individual, SortedSet<String>> getStringDatatypeMembersImpl( + DatatypeProperty datatypeProperty) throws ReasoningMethodUnsupportedException { + Map<Individual, SortedSet<Constant>> mapping = getDatatypeMembersImpl(datatypeProperty); + Map<Individual, SortedSet<String>> ret = new TreeMap<Individual, SortedSet<String>>(); + for (Entry<Individual, SortedSet<Constant>> e : mapping.entrySet()) { + SortedSet<Constant> values = e.getValue(); + SortedSet<String> valuesString = new TreeSet<String>(); + for (Constant c : values) { + valuesString.add(c.getLiteral()); + } + ret.put(e.getKey(), valuesString); + } + return ret; + } + + @Override public final SortedSet<DatatypeProperty> getDatatypeProperties() { try { return getDatatypePropertiesImpl(); Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -279,6 +279,15 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "useDoubleDatatypes") ; } /** +* useStringDatatypes specifies whether string datatypes are used in the learning algorothm. +* mandatory: false| reinit necessary: true +* default value: false +* @return boolean +**/ +public boolean getUseStringDatatypes() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "useStringDatatypes") ; +} +/** * maxExecutionTimeInSeconds algorithm will stop after specified seconds. * mandatory: false| reinit necessary: true * default value: 0 @@ -622,6 +631,15 @@ reinitNecessary = true; } /** +* @param useStringDatatypes specifies whether string datatypes are used in the learning algorothm. +* mandatory: false| reinit necessary: true +* default value: false +**/ +public void setUseStringDatatypes(boolean useStringDatatypes) { +ComponentManager.getInstance().applyConfigEntry(rOLComponent2, "useStringDatatypes", useStringDatatypes); +reinitNecessary = true; +} +/** * @param maxExecutionTimeInSeconds algorithm will stop after specified seconds. * mandatory: false| reinit necessary: true * default value: 0 Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -56,13 +56,13 @@ } /** -* numberOfTrees number of randomly generated concepts/trees. +* numberOfGuesses number of randomly generated concepts/trees. * mandatory: false| reinit necessary: true -* default value: 5 +* default value: 100 * @return int **/ -public int getNumberOfTrees() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(randomGuesser, "numberOfTrees") ; +public int getNumberOfGuesses() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(randomGuesser, "numberOfGuesses") ; } /** * maxDepth maximum depth of generated concepts/trees. @@ -75,12 +75,12 @@ } /** -* @param numberOfTrees number of randomly generated concepts/trees. +* @param numberOfGuesses number of randomly generated concepts/trees. * mandatory: false| reinit necessary: true -* default value: 5 +* default value: 100 **/ -public void setNumberOfTrees(int numberOfTrees) { -ComponentManager.getInstance().applyConfigEntry(randomGuesser, "numberOfTrees", numberOfTrees); +public void setNumberOfGuesses(int numberOfGuesses) { +ComponentManager.getInstance().applyConfigEntry(randomGuesser, "numberOfGuesses", numberOfGuesses); reinitNecessary = true; } /** Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RefinementOperatorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RefinementOperatorConfigurator.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RefinementOperatorConfigurator.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -54,4 +54,8 @@ public boolean getUseDoubleDatatypes() { return false; } + + public boolean getUseStringDatatypes() { + return false; + } } Modified: trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -49,6 +49,7 @@ public static boolean useNegationDefault = true; public static boolean useBooleanDatatypesDefault = true; public static boolean useDoubleDatatypesDefault = true; + public static boolean useStringDatatypesDefault = false; public static int maxExecutionTimeInSecondsDefault = 0; public static int minExecutionTimeInSecondsDefault = 0; public static int guaranteeXgoodDescriptionsDefault = 1; @@ -159,6 +160,10 @@ return new BooleanConfigOption("useDoubleDatatypes", "specifies whether boolean datatypes are used in the learning algorothm",useDoubleDatatypesDefault); } + public static BooleanConfigOption useStringDatatypes() { + return new BooleanConfigOption("useStringDatatypes", "specifies whether string datatypes are used in the learning algorothm",useStringDatatypesDefault); + } + public static IntegerConfigOption maxExecutionTimeInSeconds() { return new IntegerConfigOption("maxExecutionTimeInSeconds", "algorithm will stop after specified seconds",maxExecutionTimeInSecondsDefault); } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosNeg.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosNeg.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosNeg.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -53,7 +53,7 @@ */ public EvaluatedDescriptionPosNeg(Description description, ScorePosNeg score) { super(description, score); - score2 = (ScorePosNeg) score; + score2 = score; } /** Modified: trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosOnly.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosOnly.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionPosOnly.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -19,9 +19,11 @@ */ package org.dllearner.learningproblems; +import java.util.Set; + import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.Score; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; /** * @author Jens Lehmann @@ -29,8 +31,31 @@ */ public class EvaluatedDescriptionPosOnly extends EvaluatedDescription { - public EvaluatedDescriptionPosOnly(Description description, Score score) { + private ScorePosOnly score2; + + public EvaluatedDescriptionPosOnly(Description description, ScorePosOnly score) { super(description, score); + score2 = score; } + @Override + public String toString() { + return description.toString() + "(accuracy: " + getAccuracy() + ")"; + } + + /** + * @see org.dllearner.learningproblems.ScorePosNeg#getCoveredPositives() + * @return Positive examples covered by the description. + */ + public Set<Individual> getCoveredPositives() { + return score2.getCoveredInstances(); + } + + public Set<Individual> getNotCoveredPositives() { + return score2.getNotCoveredPositives(); + } + + public Set<Individual> getAdditionalInstances() { + return score2.getAdditionalInstances(); + } } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -145,9 +145,12 @@ Set<Individual> retrieval = reasoner.getIndividuals(description); Set<Individual> instancesCovered = new TreeSet<Individual>(); + Set<Individual> instancesNotCovered = new TreeSet<Individual>(); for(Individual ind : positiveExamples) { if(retrieval.contains(ind)) { instancesCovered.add(ind); + } else { + instancesNotCovered.add(ind); } } @@ -156,14 +159,14 @@ // pass only additional instances to score object retrieval.removeAll(instancesCovered); - return new ScorePosOnly(instancesCovered, coverage, retrieval, protusion, getAccuracy(coverage, protusion)); + return new ScorePosOnly(instancesCovered, instancesNotCovered, coverage, retrieval, protusion, getAccuracy(coverage, protusion)); } /* (non-Javadoc) * @see org.dllearner.core.LearningProblem#evaluate(org.dllearner.core.owl.Description) */ @Override - public EvaluatedDescription evaluate(Description description) { + public EvaluatedDescriptionPosOnly evaluate(Description description) { ScorePosOnly score = computeScore(description); return new EvaluatedDescriptionPosOnly(description, score); } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ScorePosOnly.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/ScorePosOnly.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/learningproblems/ScorePosOnly.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -31,14 +31,16 @@ public class ScorePosOnly extends Score { private Set<Individual> coveredInstances; + private Set<Individual> notCoveredPositives; private Set<Individual> additionalInstances; private double coverage; private double addition; private double accuracy; - public ScorePosOnly(Set<Individual> coveredInstances, double coverage, Set<Individual> additionalInstances, double protusion, double accuracy) { + public ScorePosOnly(Set<Individual> coveredInstances, Set<Individual> notCoveredPositives, double coverage, Set<Individual> additionalInstances, double protusion, double accuracy) { this.coveredInstances = coveredInstances; + this.notCoveredPositives = notCoveredPositives; this.additionalInstances = additionalInstances; this.coverage = coverage; this.addition = protusion; @@ -79,6 +81,13 @@ } /** + * @return the coveredInstances + */ + public Set<Individual> getNotCoveredPositives() { + return notCoveredPositives; + } + + /** * @return the additionalInstances */ public Set<Individual> getAdditionalInstances() { Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -172,6 +172,7 @@ private boolean useNegation = true; private boolean useBooleanDatatypes = true; private boolean useDoubleDatatypes = true; + private boolean useStringDatatypes = false; private boolean disjointChecks = true; private boolean instanceBasedDisjoints = true; @@ -202,6 +203,7 @@ useNegation = configurator.getUseNegation(); useBooleanDatatypes = configurator.getUseBooleanDatatypes(); useDoubleDatatypes = configurator.getUseDoubleDatatypes(); + useStringDatatypes = configurator.getUseStringDatatypes(); init(); } @@ -224,6 +226,7 @@ this.useNegation = useNegation; this.useBooleanDatatypes = useBooleanDatatypes; this.useDoubleDatatypes = useDoubleDatatypes; + useStringDatatypes = configurator.getUseStringDatatypes(); if(startClass != null) { this.startClass = startClass; } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-20 09:22:49 UTC (rev 1764) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-21 08:46:28 UTC (rev 1765) @@ -29,10 +29,17 @@ import java.util.zip.DataFormatException; import org.dllearner.algorithms.celoe.CELOE; +import org.dllearner.algorithms.refinement2.ROLComponent2; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectValueRestriction; +import org.dllearner.core.owl.Union; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.kb.manipulator.StringToResource; import org.dllearner.kb.manipulator.Rule.Months; @@ -40,6 +47,7 @@ import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlKnowledgeSource; +import org.dllearner.learningproblems.EvaluatedDescriptionPosOnly; import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.reasoning.FastInstanceChecker; @@ -74,8 +82,10 @@ // System.out.println(isCity + " " + lgdURI); if(isCity) { positives.add(lgdURI.toString()); + System.out.println("+\""+lgdURI+"\""); } else { negatives.add(lgdURI.toString()); + System.out.println("-\""+lgdURI+"\""); } } @@ -93,7 +103,7 @@ ks.getConfigurator().setPredefinedEndpoint("LOCALGEODATA"); ks.getConfigurator().setSaveExtractedFragment(true); Manipulator m = Manipulator.getDefaultManipulator(); - m.addRule(new StringToResource(Months.DECEMBER,"http://linkedgeodata.org/vocabulary", 40)); + m.addRule(new StringToResource(Months.DECEMBER,"http://linkedgeodata.org/vocabulary", 0)); ks.setManipulator(m); ks.init(); @@ -105,10 +115,36 @@ lp.init(); CELOE celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); +// ROLComponent2 celoe = cm.learningAlgorithm(ROLComponent2.class, lp, reasoner); + celoe.getConfigurator().setUseAllConstructor(false); +// celoe.getConfigurator().setUseExistsConstructor(false); + celoe.getConfigurator().setUseCardinalityRestrictions(false); + celoe.getConfigurator().setUseBooleanDatatypes(false); + celoe.getConfigurator().setUseDoubleDatatypes(false); + celoe.getConfigurator().setUseNegation(false); celoe.getConfigurator().setUseHasValueConstructor(true); - celoe.getConfigurator().setValueFrequencyThreshold(3); + celoe.getConfigurator().setValueFrequencyThreshold(10); + celoe.getConfigurator().setMaxExecutionTimeInSeconds(1000); + celoe.getConfigurator().setNoisePercentage(0.1); celoe.init(); + // debugging +// ObjectProperty place = new ObjectProperty("http://linkedgeodata.org/vocabulary#place"); +// Individual city = new Individual("http://linkedgeodata.org/vocabulary/city"); +// Individual village = new Individual("http://linkedgeodata.org/vocabulary/village"); +// Individual town = new Individual("http://linkedgeodata.org/vocabulary/town"); +// Individual suburb = new Individual("http://linkedgeodata.org/vocabulary/suburb"); +// Description vd = new ObjectValueRestriction(place, village); +// Description vc = new ObjectValueRestriction(place, city); +// Description vt = new ObjectValueRestriction(place, town); +// Description vs = new ObjectValueRestriction(place, suburb); +// Description d = new Union(vd, vt, vs); +// EvaluatedDescriptionPosOnly ed = lp.evaluate(d); +// System.out.println(ed); +// System.out.println(ed.getCoveredPositives().size() + ": " + ed.getCoveredPositives()); +// System.out.println(ed.getNotCoveredPositives().size() + ": " + ed.getNotCoveredPositives()); +// System.out.println(ed.getAdditionalInstances().size() + ": " + ed.getAdditionalInstances()); + // execute algorithm celoe.start(); // Set<EvaluatedDescriptionPosOnly> solutions = (Set<EvaluatedDescriptionPosOnly>) algorithm.getCurrentlyBestEvaluatedDescriptions(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-05-20 09:23:00
|
Revision: 1764 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1764&view=rev Author: lorenz_b Date: 2009-05-20 09:22:49 +0000 (Wed, 20 May 2009) Log Message: ----------- added refreshing action after executing repair plan Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/AxiomRanker.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/RepairPlanPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairTable.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairTableModel.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -13,6 +13,7 @@ import org.dllearner.tools.ore.explanation.RootFinder; import org.mindswap.pellet.owlapi.PelletReasonerFactory; import org.mindswap.pellet.owlapi.Reasoner; +import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; @@ -29,7 +30,7 @@ import com.clarkparsia.explanation.PelletExplanation; -public class ExplanationManager implements OWLOntologyChangeListener{ +public class ExplanationManager implements OWLOntologyChangeListener, ImpactManagerListener{ private static ExplanationManager instance; @@ -49,17 +50,18 @@ - private ExplanationManager(OWLOntologyManager manager, Reasoner reasoner, - OWLOntology ontology) { + private ExplanationManager(Reasoner reasoner) { regularExplanationCache = new HashMap<OWLClass, Set<Set<OWLAxiom>>>(); laconicExplanationCache = new HashMap<OWLClass, Set<Set<OWLAxiom>>>(); - this.manager = manager; this.reasoner = reasoner; - this.ontology = ontology; + this.manager = reasoner.getManager(); + this.ontology = reasoner.getLoadedOntologies().iterator().next(); + manager.addOntologyChangeListener(this); + manager.addOntologyChangeListener(reasoner); dataFactory = manager.getOWLDataFactory(); - + ImpactManager.getImpactManager(reasoner).addListener(this); reasonerFactory = new PelletReasonerFactory(); rootFinder = new RootFinder(manager, reasoner, reasonerFactory); @@ -75,9 +77,9 @@ } public static synchronized ExplanationManager getExplanationManager( - OWLOntologyManager manager, Reasoner reasoner, OWLOntology ontology) { + Reasoner reasoner) { if (instance == null) { - instance = new ExplanationManager(manager, reasoner, ontology); + instance = new ExplanationManager(reasoner); } return instance; } @@ -177,10 +179,12 @@ } @Override - public void ontologiesChanged(List<? extends OWLOntologyChange> arg0) - throws OWLException { + public void ontologiesChanged(List<? extends OWLOntologyChange> changes) + throws OWLException {System.out.println(changes); ontologyChanged = true; + + } public int getArity(OWLClass cl, OWLAxiom ax) { @@ -197,6 +201,20 @@ } return arity; } + + @Override + public void axiomForImpactChanged() { + // TODO Auto-generated method stub + + } + + @Override + public void repairPlanExecuted() { + reasoner.refresh(); + ontologyChanged = true; + regularExplanationCache.clear(); + laconicExplanationCache.clear(); + } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -31,17 +31,22 @@ import javax.swing.event.ListSelectionListener; import org.jdesktop.swingx.JXList; +import org.mindswap.pellet.PelletOptions; import org.mindswap.pellet.owlapi.PelletReasonerFactory; import org.mindswap.pellet.owlapi.Reasoner; +import org.mindswap.pellet.utils.progress.SwingProgressMonitor; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLException; import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChange; +import org.semanticweb.owl.model.OWLOntologyChangeListener; import org.semanticweb.owl.model.OWLOntologyCreationException; import org.semanticweb.owl.model.OWLOntologyManager; public class ExplanationPanel extends JPanel implements ListSelectionListener, - ActionListener { + ActionListener,ImpactManagerListener{ private JXList unsatList; private JSplitPane splitPane; @@ -74,6 +79,7 @@ this.expManager = expMan; this.impManager = impMan; + impManager.addListener(this); setLayout(new BorderLayout()); Dimension minimumSize = new Dimension(400, 400); @@ -121,14 +127,29 @@ statsSplitPane.setResizeWeight(1.0D); statsSplitPane.setTopComponent(buttonExplanationsPanel); + //repair panel + JPanel impactRepairPanel = new JPanel(); + impactRepairPanel.setLayout(new BorderLayout()); + impactRepairPanel.add(new JLabel("Repair plan"), BorderLayout.NORTH); + JSplitPane impRepSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + impRepSplit.setOneTouchExpandable(true); + impRepSplit.setDividerLocation(600); + impRepSplit.setBorder(null); + impactRepairPanel.add(impRepSplit); + JPanel impactPanel = new JPanel(); impactPanel.setLayout(new BorderLayout()); impactPanel.add(new JLabel("Lost entailments"), BorderLayout.NORTH); - JScrollPane scr = new JScrollPane(new ImpactTable(impManager)); - impactPanel.add(scr); + JScrollPane impScr = new JScrollPane(new ImpactTable(impManager)); + impactPanel.add(impScr); + impRepSplit.setRightComponent(impactPanel); - statsSplitPane.setBottomComponent(impactPanel); + RepairPlanPanel repairPanel = new RepairPlanPanel(impManager); + impRepSplit.setLeftComponent(repairPanel); + + statsSplitPane.setBottomComponent(impactRepairPanel); + statsSplitPane.setBorder(null); statsSplitPane.setDividerLocation(500); statsSplitPane.setOneTouchExpandable(true); @@ -235,9 +256,9 @@ // editor.setDescription(unsatClass); - if (regularButton.isSelected()) { + if (!unsatList.isSelectionEmpty() && regularButton.isSelected()) { showRegularExplanations(); - } else { + } else if(!unsatList.isSelectionEmpty()){ showLaconicExplanations(); } @@ -254,30 +275,73 @@ } } + + @Override + public void axiomForImpactChanged() { + // TODO Auto-generated method stub + + } + @Override + public void repairPlanExecuted() { + explanationsPanel.removeAll(); + + fillUnsatClassesList(); + repaint(); + } + + public static void main(String[] args) { try { - String file = "file:examples/ore/koala.owl"; + String file = "file:examples/ore/miniEconomy.owl"; + PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.NONE; OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.loadOntologyFromPhysicalURI(URI .create(file)); + + org.mindswap.pellet.utils.progress.ProgressMonitor mon = new SwingProgressMonitor(); PelletReasonerFactory reasonerFactory = new PelletReasonerFactory(); Reasoner reasoner = reasonerFactory.createReasoner(manager); reasoner.loadOntologies(Collections.singleton(ontology)); +// reasoner.getKB().getTaxonomyBuilder().setProgressMonitor(mon); +// mon.taskStarted(); reasoner.classify(); +// mon.taskFinished(); + + + +// try { +// String text = "Koala SubclassOf Class: Animal"; +// OWLEntityChecker checker = new EntityChecker(manager); +// ManchesterOWLSyntaxEditorParser parser = new ManchesterOWLSyntaxEditorParser(manager.getOWLDataFactory(),text); +// parser.setOWLEntityChecker(checker); +// parser.parseOntology(manager, ontology); +// parser.setBase(ontology.getURI().toString() + "#"); +// parser.parseDescription(); +// } catch (OWLOntologyChangeException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (ParserException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } + + + + ExplanationManager expManager = ExplanationManager - .getExplanationManager(manager, reasoner, ontology); - ImpactManager impManager = ImpactManager.getImpactManager(manager, - reasoner, ontology); + .getExplanationManager(reasoner); + ImpactManager impManager = ImpactManager.getImpactManager( + reasoner); ExplanationPanel panel = new ExplanationPanel(expManager, impManager); - + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame test = new JFrame(); test.setLayout(new GridLayout(0, 1)); - test.setSize(new Dimension(1200, 700)); + test.setSize(new Dimension(1400, 1000)); test.add(panel); test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); test.setVisible(true); @@ -302,4 +366,8 @@ } } + + + + } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTable.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTable.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -6,6 +6,8 @@ import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.List; import javax.swing.AbstractCellEditor; @@ -35,6 +37,7 @@ public ExplanationTable(List<OWLAxiom> explanation, ImpactManager impMan, ExplanationManager expMan, OWLClass cl) { this.explanation = explanation; this.impMan = impMan; + impMan.addListener(this); setBackground(Color.WHITE); setAutoResizeMode(JTable.AUTO_RESIZE_OFF); setModel(new ExplanationTableModel(explanation, expMan, impMan, cl)); @@ -86,6 +89,19 @@ } }); + + addMouseListener(new MouseAdapter() { + + final ExplanationTable table; + { + table = ExplanationTable.this; + } + public void mouseClicked(MouseEvent e){ + if(e.getClickCount() == 2){ + System.out.println(getValueAt(table.rowAtPoint(e.getPoint()), 0)); + } + } + }); } private OWLAxiom getOWLAxiomAtRow(int rowIndex){ @@ -100,13 +116,13 @@ private void changeSelection() { - - if(getSelectedRow() >=0){ - OWLAxiom rowAxiom = getOWLAxiomAtRow(getSelectedRow()); - impMan.setActualAxiom(rowAxiom); - } else { - impMan.setActualAxiom(null); - } +// +// if(getSelectedRow() >=0){ +// OWLAxiom rowAxiom = getOWLAxiomAtRow(getSelectedRow()); +// impMan.setActualAxiom(rowAxiom); +// } else { +// impMan.setActualAxiom(null); +// } } @@ -179,6 +195,12 @@ repaint(); } + + @Override + public void repairPlanExecuted() { + // TODO Auto-generated method stub + + } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTableModel.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTableModel.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -49,7 +49,7 @@ } else if(columnIndex == 1){ return expMan.getArity(unsat, axioms.get(rowIndex)); } else if(columnIndex == 2) { - return Boolean.valueOf(impMan.isSelected(getOWLAxiomAtRow(rowIndex)));//remove.get(rowIndex); + return Boolean.valueOf(impMan.isSelected(getOWLAxiomAtRow(rowIndex))); } else { return "rewrite"; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -11,7 +11,10 @@ import org.mindswap.pellet.owlapi.Reasoner; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChange; +import org.semanticweb.owl.model.OWLOntologyChangeException; import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.RemoveAxiom; public class ImpactManager { @@ -21,12 +24,16 @@ private OWLAxiom actual; private List<OWLAxiom> selectedAxioms; private List<ImpactManagerListener> listeners; + private OWLOntology ontology; + private OWLOntologyManager manager; - private ImpactManager(OWLOntologyManager manager, Reasoner reasoner, OWLOntology ontology) { + private ImpactManager(Reasoner reasoner) { + this.ontology = reasoner.getLoadedOntologies().iterator().next(); + this.manager = reasoner.getManager(); impact = new HashMap<OWLAxiom, Set<OWLAxiom>>(); selectedAxioms = new ArrayList<OWLAxiom>(); listeners = new ArrayList<ImpactManagerListener>(); - ranker = new AxiomRanker(ontology, reasoner, manager.getOWLDataFactory()); + ranker = new AxiomRanker(ontology, reasoner, manager); } @@ -42,24 +49,41 @@ listeners.remove(listener); } - public static synchronized ImpactManager getImpactManager(OWLOntologyManager manager, Reasoner reasoner, OWLOntology ontology) { + public static synchronized ImpactManager getImpactManager(Reasoner reasoner) { if (instance == null) { - instance = new ImpactManager(manager, reasoner, ontology); + instance = new ImpactManager(reasoner); } return instance; } - public Set<OWLAxiom> getImpactAxioms() { - Set<OWLAxiom> imp = impact.get(actual); + public Set<OWLAxiom> getImpactAxioms(OWLAxiom ax) { + + Set<OWLAxiom> imp = impact.get(ax); if (imp == null) { imp = new HashSet<OWLAxiom>(); - impact.put(actual, imp); - imp.addAll(ranker.computeImpactSOS(actual)); + impact.put(ax, imp); + if(ax != null){ + imp.addAll(ranker.computeImpactOnRemoval(ax)); + imp.addAll(ranker.computeImpactSOS(ax));//computeImpactSOS(actual)); + } } return imp; } + public Set<OWLAxiom> getImpactForAxioms2Remove(){ + Set<OWLAxiom> totalImpact = new HashSet<OWLAxiom>(); + for(OWLAxiom ax : selectedAxioms){ + Set<OWLAxiom> imp = getImpactAxioms(ax); + if(imp != null){ + totalImpact.addAll(imp); + } + + + } + return totalImpact; + } + public void setActualAxiom(OWLAxiom ax){ actual = ax; fireAxiomForImpactChanged(); @@ -67,6 +91,7 @@ public void addAxiom2ImpactList(OWLAxiom ax){ selectedAxioms.add(ax); + fireAxiomForImpactChanged(); } @@ -79,11 +104,37 @@ return selectedAxioms.contains(ax); } + public List<OWLAxiom> getAxioms2Remove(){ + return selectedAxioms; + } + + public void executeRepairPlan(){ + List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); + for(OWLAxiom ax : selectedAxioms){ + changes.add(new RemoveAxiom(ontology, ax)); + } + try { + manager.applyChanges(changes); + } catch (OWLOntologyChangeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + impact.clear(); + selectedAxioms.clear(); + fireRepairPlanExecuted(); + } + private void fireAxiomForImpactChanged(){ for(ImpactManagerListener listener : listeners){ listener.axiomForImpactChanged(); } } + private void fireRepairPlanExecuted(){ + for(ImpactManagerListener listener : listeners){ + listener.repairPlanExecuted(); + } + } + } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -2,4 +2,5 @@ public interface ImpactManagerListener { public abstract void axiomForImpactChanged(); + public abstract void repairPlanExecuted(); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTableModel.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTableModel.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -30,7 +30,7 @@ private void rebuildData() { impact.clear(); - impact.addAll(impMan.getImpactAxioms()); + impact.addAll(impMan.getImpactForAxioms2Remove()); Collections.sort(impact); fireTableDataChanged(); } @@ -58,4 +58,12 @@ rebuildData(); } + + @Override + public void repairPlanExecuted() { + rebuildData(); + + } + + } Added: trunk/src/dl-learner/org/dllearner/tools/ore/RepairPlanPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairPlanPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairPlanPanel.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -0,0 +1,43 @@ +package org.dllearner.tools.ore; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +public class RepairPlanPanel extends JPanel { + + /** + * + */ + private static final long serialVersionUID = 537629900742120594L; + private ImpactManager impMan; + + public RepairPlanPanel(ImpactManager impMan) { + this.impMan = impMan; + + setLayout(new BorderLayout()); + add(new JLabel("Axioms to remove"), BorderLayout.NORTH); + JPanel buttonPanel = new JPanel(new FlowLayout(2)); + add(buttonPanel, "South"); + buttonPanel.add(new JButton(new AbstractAction("compute plan") { + + public void actionPerformed(ActionEvent e) { + computeRepairPlan(); + } + + })); + + JScrollPane repScr = new JScrollPane(new RepairTable(impMan)); + add(repScr); + } + + private void computeRepairPlan() { + impMan.executeRepairPlan(); + } +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/RepairTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairTable.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairTable.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -0,0 +1,24 @@ +package org.dllearner.tools.ore; + +import java.awt.Color; + +import org.jdesktop.swingx.JXTable; + +public class RepairTable extends JXTable { + + /** + * + */ + private static final long serialVersionUID = -621497634521668635L; + + public RepairTable(ImpactManager manager){ + super(new RepairTableModel(manager)); + + setShowHorizontalLines(true); + setGridColor(Color.LIGHT_GRAY); + setTableHeader(null); + getColumnModel().getColumn(0).setCellRenderer(new OWLSyntaxTableCellRenderer()); + setRowHeight(getRowHeight() + 4); + + } +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/RepairTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairTableModel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairTableModel.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -0,0 +1,67 @@ +package org.dllearner.tools.ore; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.swing.table.AbstractTableModel; + +import org.semanticweb.owl.model.OWLAxiom; + +public class RepairTableModel extends AbstractTableModel implements ImpactManagerListener{ + + /** + * + */ + private static final long serialVersionUID = -5898900692701380258L; + private ImpactManager impMan; + private List<OWLAxiom> axioms2Remove; + + public RepairTableModel(ImpactManager impMan) + { + + axioms2Remove = new ArrayList<OWLAxiom>(); + this.impMan = impMan; + impMan.addListener(this); + rebuildData(); + } + + private void rebuildData() + { + axioms2Remove.clear(); + axioms2Remove.addAll(impMan.getAxioms2Remove()); + Collections.sort(axioms2Remove); + fireTableDataChanged(); + } + + + + public int getRowCount() + { + return axioms2Remove.size(); + } + + public int getColumnCount() + { + return 1; + } + + public Object getValueAt(int rowIndex, int columnIndex) + { + return axioms2Remove.get(rowIndex); + } + + + @Override + public void axiomForImpactChanged() { + rebuildData(); + + } + + @Override + public void repairPlanExecuted() { + rebuildData(); + + } + +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/AxiomRanker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/AxiomRanker.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/AxiomRanker.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -11,6 +11,8 @@ import org.mindswap.pellet.owlapi.Reasoner; import org.mindswap.pellet.utils.SetUtils; import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.inference.OWLReasonerException; +import org.semanticweb.owl.model.AxiomType; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; @@ -26,19 +28,82 @@ import org.semanticweb.owl.model.OWLSubClassAxiom; import org.semanticweb.owl.model.RemoveAxiom; +import com.clarkparsia.modularity.IncrementalClassifier; + public class AxiomRanker { private Map axiomSOSMap; + private OWLOntology ontology; private Reasoner reasoner; + private OWLOntologyManager manager; private OWLDataFactory factory; + boolean enableImpactUnsat; - public AxiomRanker(OWLOntology ont, Reasoner reasoner, OWLDataFactory fact){ + public AxiomRanker(OWLOntology ont, Reasoner reasoner, OWLOntologyManager mng){ this.ontology = ont; this.reasoner = reasoner; - this.factory = fact; + this.manager = mng; + this.factory = manager.getOWLDataFactory(); } + + public Set<OWLAxiom> computeImpactOnRemoval(OWLAxiom ax){ + Set<OWLAxiom> impact = new HashSet<OWLAxiom>(); + + try { + IncrementalClassifier classifier = new IncrementalClassifier(manager); + classifier.loadOntology(ontology); + classifier.classify(); + Set<OWLClass> inc = classifier.getInconsistentClasses(); + for(OWLDescription cl : ontology.getClassesInSignature()){ + if(!inc.contains(cl)){ + for(OWLClass sup : SetUtils.union(classifier.getAncestorClasses(cl))){ + if(!sup.equals(factory.getOWLThing())){ + for(OWLClass sub : SetUtils.union(classifier.getDescendantClasses(cl))){ + if(!sub.equals(factory.getOWLNothing())){ + impact.add(factory.getOWLSubClassAxiom(cl, sup)); + } + } + + } + } + + } + } + + + manager.applyChange(new RemoveAxiom(ontology, ax)); + classifier.classify(); + inc = classifier.getInconsistentClasses(); + + for(OWLDescription cl : ontology.getClassesInSignature()){ + if(!inc.contains(cl)){ + for(OWLClass sup : SetUtils.union(classifier.getAncestorClasses(cl))){ + if(!sup.equals(factory.getOWLThing())){ + for(OWLClass sub : SetUtils.union(classifier.getDescendantClasses(cl))){ + if(!sub.equals(factory.getOWLNothing())){ + impact.remove(factory.getOWLSubClassAxiom(cl, sup)); + } + } + + } + } + + } + } + manager.addAxiom(ontology, ax);classifier.classify(); + + } catch (OWLReasonerException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLOntologyChangeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return impact; + } public Set<OWLAxiom> computeImpactSOS(OWLAxiom axiom) { Set<OWLAxiom> result = new HashSet<OWLAxiom>(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -286,8 +286,7 @@ public Set<Set<OWLAxiom>> getRegularExplanations(OWLAxiom entailment) throws ExplanationException { Set<Set<OWLAxiom>> regularJusts; - - regularJusts = pelletExplanation.getEntailmentExplanations((OWLAxiom)entailment); + regularJusts = pelletExplanation.getEntailmentExplanations((OWLAxiom)entailment); lastRegularJusts.addAll(regularJusts); return regularJusts; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java 2009-05-20 09:15:53 UTC (rev 1763) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java 2009-05-20 09:22:49 UTC (rev 1764) @@ -15,6 +15,7 @@ import org.semanticweb.owl.inference.OWLReasonerException; import org.semanticweb.owl.inference.OWLReasonerFactory; import org.semanticweb.owl.model.AxiomType; +import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataAllRestriction; import org.semanticweb.owl.model.OWLDataExactCardinalityRestriction; @@ -83,6 +84,7 @@ } public Set<OWLClass> getRootClasses(){ + rootClasses.clear(); computePossibleRoots(); pruneRoots(); rootClasses.remove(manager.getOWLDataFactory().getOWLNothing()); @@ -164,6 +166,7 @@ } private void reset(){ + depend2Classes.clear(); depth2ExistsRestrictionPropertyMap.clear(); depth2UniversalRestrictionPropertyMap.clear(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2009-05-20 09:16:00
|
Revision: 1763 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1763&view=rev Author: kurzum Date: 2009-05-20 09:15:53 +0000 (Wed, 20 May 2009) Log Message: ----------- fixed rule for lgd Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java 2009-05-20 08:50:53 UTC (rev 1762) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java 2009-05-20 09:15:53 UTC (rev 1763) @@ -73,6 +73,16 @@ } if(tuple.b.toString().startsWith("http://")){ + //System.out.println(tuple.b.toString()); + if( + tuple.b.toString().startsWith("http://ru.wikipedia.org/wiki/СеÑ") || + tuple.bPartContains(" ") + + ){ + continue; + + } + tuple.b = new ResourceImpl(tuple.b.toString()); replace= false; } @@ -94,6 +104,7 @@ // do nothing } } + keep.add(tuple); } return keep; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-20 08:50:59
|
Revision: 1762 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1762&view=rev Author: jenslehmann Date: 2009-05-20 08:50:53 +0000 (Wed, 20 May 2009) Log Message: ----------- prepared SPARQL based matching Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java trunk/src/dl-learner/org/dllearner/scripts/matching/Point.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-19 21:05:48 UTC (rev 1761) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-05-20 08:50:53 UTC (rev 1762) @@ -70,7 +70,7 @@ // true = SPARQL is used for retrieving close points; // false = Triplify spatial extension is used - private static boolean useSparqlForGettingNearbyPoints = false; + private static boolean useSparqlForGettingNearbyPoints = true; public static void main(String[] args) throws IOException { @@ -266,36 +266,87 @@ if(useSparqlForGettingNearbyPoints) { // TODO: convert from meters to lat/long - double distanceThresholdLat = 0.3; - double distanceThresholdLong = 0.3; + double distanceThresholdLat = 0.5; + double distanceThresholdLong = 0.5; + // Triplify: $1= , $2= , $3 = distance in meters + // $box='longitude between CEIL(($2-($3/1000)/abs(cos(radians($1))*111))*10000000) and CEIL(($2+($3/1000)/abs(cos(radians($1))*111))*10000000) + // AND latitude between CEIL(($1-($3/1000/111))*10000000) and CEIL(($1+($3/1000/111))*10000000)'; + // create a box around the point double minLat = dbpediaPoint.getGeoLat() - distanceThresholdLat; double maxLat = dbpediaPoint.getGeoLat() + distanceThresholdLat; double minLong = dbpediaPoint.getGeoLong() - distanceThresholdLong; double maxLong = dbpediaPoint.getGeoLong() + distanceThresholdLong; - // query all points in the box - String queryStr = "select ?point ?lat ?long ?name where { "; + // query all points in the box corresponding to this class + // (we make sure that returned points are in the same POI class) + String queryStr = "select ?point ?lat ?long ?name ?name_en ?name_int where { "; + queryStr += LGDPoint.getSPARQLRestriction(dbpediaPoint.getPoiClass(), "?point"); queryStr += "?point <http://linkedgeodata.org/vocabulary/latitude> ?lat ."; queryStr += "FILTER (xsd:float(?lat) > " + minLat + ") ."; queryStr += "FILTER (xsd:float(?lat) < " + maxLat + ") ."; queryStr += "?point <http://linkedgeodata.org/vocabulary/longitude> ?long ."; queryStr += "FILTER (xsd:float(?long) > " + minLong + ") ."; queryStr += "FILTER (xsd:float(?long) < " + maxLong + ") ."; - queryStr += "?point <http://linkedgeodata.org/vocabulary/name> ?name ."; + queryStr += "?point <http://linkedgeodata.org/vocabulary/name> ?name ."; + queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary/name%25en> ?name_en } ."; + queryStr += "OPTIONAL { ?point <http://linkedgeodata.org/vocabulary/name_int> ?name_int } ."; queryStr += "}"; SparqlQuery query = new SparqlQuery(queryStr, geoDataEndpoint); ResultSet rs = query.send(); + double highestScore = 0; + String bestURI = null; + String bestLabel = null; while(rs.hasNext()) { -// QuerySolution qs = rs.nextSolution(); + QuerySolution qs = rs.nextSolution(); // measure string similarity and proximity // TODO: incomplete - } - return null; + + // step 1: string similarity + double stringSimilarity; + // from DBpedia we take the full label and an abbreviated version; + // from LGD we take name, name%25en, name, int_name + String dbpediaLabel1 = dbpediaPoint.getLabel(); + String dbpediaLabel2 = dbpediaPoint.getPlainLabel(); + String lgdLabel1 = qs.getLiteral("name").toString(); + stringSimilarity = distance.score(dbpediaLabel1, lgdLabel1); + stringSimilarity = Math.max(distance.score(dbpediaLabel2, lgdLabel1), stringSimilarity); + if(qs.contains("name_en")) { + String lgdLabel2 = qs.getLiteral("name_en").toString(); + stringSimilarity = distance.score(dbpediaLabel1, lgdLabel2); + stringSimilarity = Math.max(distance.score(dbpediaLabel2, lgdLabel2), stringSimilarity); + } + if(qs.contains("name_int")) { + String lgdLabel3 = qs.getLiteral("name_int").toString(); + stringSimilarity = distance.score(dbpediaLabel1, lgdLabel3); + stringSimilarity = Math.max(distance.score(dbpediaLabel2, lgdLabel3), stringSimilarity); + } + + // step 2: spatial distance + // ... not yet taken into account ... see spatialDistance() method below + + double score = stringSimilarity; + + if(score > highestScore) { + highestScore = score; + bestURI = qs.getResource("point").getURI(); + bestLabel = lgdLabel1; + } + + } + + if(highestScore > scoreThreshold) { + System.out.println("Match: " + highestScore + " " + bestLabel + " (" + bestURI + ")"); + return URI.create(bestURI); + } else { + System.out.println("No match: " + highestScore + " " + bestLabel + " (" + bestURI + ")"); + return null; + } + // use Tripliy spatial extension } else { @@ -349,4 +400,24 @@ } } } + + // returns distance between two points in meters + public static double spatialDistance(double lat1, double long1, double lat2, double long2) { +// $distance='ROUND(1000*1.609 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($1 - latitude/10000000) * pi()/180 / 2), 2) + +// COS($1 * pi()/180) * COS(latitude/10000000 * pi()/180) * POWER(SIN(($2 - longitude/10000000) * pi() +// /180 / 2), 2) ) )) AS distance'; +// double distance = 1000 * 1.609 * 3956 * 2 * +// Math.asin(Math.sqrt(Math.pow(Math.sin((lat1 - lat2)/1000000, b))); + + // implementation according to http://www.movable-type.co.uk/scripts/latlong.html + double r = 6371000; // meters + double dLat = Math.toRadians(lat2-lat1); + double dLon = Math.toRadians(long2-long1); + double a = Math.sin(dLat/2) * Math.sin(dLat/2) + + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * + Math.sin(dLon/2) * Math.sin(dLon/2); + double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); + double distance = r * c; + return distance; + } } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-19 21:05:48 UTC (rev 1761) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-20 08:50:53 UTC (rev 1762) @@ -22,6 +22,8 @@ import java.net.URI; import java.util.LinkedList; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.dllearner.kb.sparql.SparqlQuery; @@ -35,8 +37,6 @@ * */ public class DBpediaPoint extends Point { - - private URI uri; private String label; @@ -46,13 +46,14 @@ // number of decimals indicates a large object) private int decimalCount; + Pattern pattern = Pattern.compile("\\w+"); /** * Constructs a DBpedia point using SPARQL. * @param uri URI of DBpedia resource. */ public DBpediaPoint(URI uri) throws Exception { - super(0,0); + super(uri, null, 0,0); this.uri = uri; // construct DBpedia query @@ -91,30 +92,35 @@ } classes = classList.toArray(classes); + poiClass = getPOIClass(classes); } public DBpediaPoint(URI uri, String label, String[] classes, double geoLat, double geoLong, int decimalCount) { - super(geoLat,geoLong); - this.uri = uri; + super(uri, null, geoLat,geoLong); this.label = label; this.classes = classes; this.decimalCount = decimalCount; + poiClass = getPOIClass(classes); } /** - * @return the uri - */ - public URI getUri() { - return uri; - } - - /** * @return the label */ public String getLabel() { return label; } + /** + * + * @return Returns only first characters until a special symbol occurs, i.e. instead + * of "Stretton, Derbyshire" it returns "Stretton". + */ + public String getPlainLabel() { + Matcher matcher = pattern.matcher(label); + matcher.find(); + return label.substring(0, matcher.end()); + } + public String[] getClasses() { return classes; } @@ -134,4 +140,13 @@ } return str + ")"; } + + private POIClass getPOIClass(String[] classes) { + for(String clazz : classes) { + if(clazz.equals("http://dbpedia.org/ontology/City")) { + return POIClass.CITY; + } + } + return null; + } } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-19 21:05:48 UTC (rev 1761) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-20 08:50:53 UTC (rev 1762) @@ -72,7 +72,7 @@ // memory to efficiently evaluate a lot of parameter settings without // requiring to perform slow HTTP or SPARQL requests - logger.trace("searching match for " + match.getKey() + "..."); +// logger.trace("searching match for " + match.getKey() + "..."); DBpediaPoint dbpediaPoint = null; try { @@ -82,8 +82,17 @@ discarded++; continue; } - URI matchedURI = DBpediaLinkedGeoData.findGeoDataMatch(dbpediaPoint); + URI matchedURI = null; + + if(dbpediaPoint.getPoiClass() == POIClass.CITY) { + logger.trace("searching match for " + match.getKey() + "..."); + matchedURI = DBpediaLinkedGeoData.findGeoDataMatch(dbpediaPoint); + } else { + System.out.println("skipping"); + continue; + } + URI testURI = match.getValue(); // no match found Copied: trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java (from rev 1760, trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java 2009-05-20 08:50:53 UTC (rev 1762) @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.scripts.matching; + +import java.net.URI; + +/** + * A LinkedGeoData point. + * + * @author Jens Lehmann + * + */ +public class LGDPoint extends Point { + + private double name; + + public LGDPoint(URI uri, double geoLat, double geoLong) { + super(uri, null, geoLat, geoLong); + } + + /** + * @return the name + */ + public double getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(double name) { + this.name = name; + } + + public static String getSPARQLRestriction(POIClass poiClass, String variable) { + switch(poiClass) { + case CITY : return variable + " <http://linkedgeodata.org/vocabulary#amenity> \"city\" ."; + default: throw new Error("Cannot restrict."); + } + } +} Property changes on: trunk/src/dl-learner/org/dllearner/scripts/matching/LGDPoint.java ___________________________________________________________________ Added: svn:mergeinfo + Deleted: trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java 2009-05-19 21:05:48 UTC (rev 1761) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java 2009-05-20 08:50:53 UTC (rev 1762) @@ -1,96 +0,0 @@ -/** - * Copyright (C) 2007-2009, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.scripts.matching; - -/** - * @author Jens Lehmann - * - */ -public class OSMPoint { - - private long id; - - private double geoLat; - - private double geoLong; - - private double name; - - public OSMPoint(long id) { - this.id = id; - } - - /** - * @return the geoLat - */ - public double getGeoLat() { - return geoLat; - } - - /** - * @param geoLat the geoLat to set - */ - public void setGeoLat(double geoLat) { - this.geoLat = geoLat; - } - - /** - * @return the geoLong - */ - public double getGeoLong() { - return geoLong; - } - - /** - * @param geoLong the geoLong to set - */ - public void setGeoLong(double geoLong) { - this.geoLong = geoLong; - } - - /** - * @return the name - */ - public double getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(double name) { - this.name = name; - } - - /** - * @return the id - */ - public long getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(long id) { - this.id = id; - } - -} Added: trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/POIClass.java 2009-05-20 08:50:53 UTC (rev 1762) @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.scripts.matching; + +/** + * Contains all types of points of interests (POIs) we are + * interested in. + * + * @author Jens Lehmann + * + */ +public enum POIClass { + + CITY, COUNTRY + +} Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/Point.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Point.java 2009-05-19 21:05:48 UTC (rev 1761) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Point.java 2009-05-20 08:50:53 UTC (rev 1762) @@ -19,6 +19,8 @@ */ package org.dllearner.scripts.matching; +import java.net.URI; + /** * A geo location. * @@ -26,12 +28,18 @@ * */ public class Point { - + protected double geoLat; protected double geoLong; - public Point(double geoLat, double geoLong) { + protected URI uri; + + protected POIClass poiClass; + + public Point(URI uri, POIClass poiClass, double geoLat, double geoLong) { + this.uri = uri; + this.poiClass = poiClass; this.geoLat = geoLat; this.geoLong = geoLong; } @@ -44,4 +52,12 @@ return geoLong; } + public URI getUri() { + return uri; + } + + public POIClass getPoiClass() { + return poiClass; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-19 21:05:57
|
Revision: 1761 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1761&view=rev Author: jenslehmann Date: 2009-05-19 21:05:48 +0000 (Tue, 19 May 2009) Log Message: ----------- minor change Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-19 17:51:46 UTC (rev 1760) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-19 21:05:48 UTC (rev 1761) @@ -33,6 +33,7 @@ import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; +import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.kb.manipulator.StringToResource; import org.dllearner.kb.manipulator.Rule.Months; import org.dllearner.kb.sparql.Cache; @@ -91,7 +92,9 @@ ks.getConfigurator().setInstances(instances); ks.getConfigurator().setPredefinedEndpoint("LOCALGEODATA"); ks.getConfigurator().setSaveExtractedFragment(true); - ks.getManipulator().addRule(new StringToResource(Months.DECEMBER,"http://linkedgeodata.org/vocabulary", 40)); + Manipulator m = Manipulator.getDefaultManipulator(); + m.addRule(new StringToResource(Months.DECEMBER,"http://linkedgeodata.org/vocabulary", 40)); + ks.setManipulator(m); ks.init(); ReasonerComponent reasoner = cm.reasoner(FastInstanceChecker.class, ks); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2009-05-19 17:51:56
|
Revision: 1760 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1760&view=rev Author: kurzum Date: 2009-05-19 17:51:46 +0000 (Tue, 19 May 2009) Log Message: ----------- fix Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2009-05-19 17:23:45 UTC (rev 1759) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2009-05-19 17:51:46 UTC (rev 1760) @@ -80,7 +80,7 @@ } else if(predefinedManipulator.equalsIgnoreCase("DEFAULT") ||predefinedManipulator.equalsIgnoreCase("STANDARD")){ return getDefaultManipulator(); - } + } else { //QUALITY maybe not the best, return getDefaultManipulator(); Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java 2009-05-19 17:23:45 UTC (rev 1759) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/StringToResource.java 2009-05-19 17:51:46 UTC (rev 1760) @@ -48,7 +48,7 @@ slash="/"; } - this.namespace = slash+resourceNamespace; + this.namespace = resourceNamespace+slash; this.limit = limit; } @@ -57,20 +57,26 @@ public SortedSet<RDFNodeTuple> applyRule(Node subject, SortedSet<RDFNodeTuple> tuples){ SortedSet<RDFNodeTuple> keep = new TreeSet<RDFNodeTuple>(); for (RDFNodeTuple tuple : tuples) { + // do nothing if the object contains http:// - if(!tuple.b.isResource()){ + if(!tuple.b.isURIResource()){ boolean replace = true; + //check for numbers - if(((Literal) tuple.b).getDatatypeURI().contains("decimal")){ + if(((Literal) tuple.b).getDatatypeURI()!= null){ replace = false; } - // do nothing if limit is exceeded if(limit != 0 && tuple.b.toString().length()>limit){ replace = false; } + if(tuple.b.toString().startsWith("http://")){ + replace= false; + } + + if (replace){ String tmp = tuple.b.toString(); @@ -78,7 +84,8 @@ //encode tmp = URLEncoder.encode(tmp, "UTF-8"); }catch (Exception e) { - // TODO: handle exception + e.printStackTrace(); + System.exit(0); } tuple.b = new ResourceImpl(namespace+tmp); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2009-05-19 17:23:45 UTC (rev 1759) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2009-05-19 17:51:46 UTC (rev 1760) @@ -111,7 +111,9 @@ private OWLOntology fragment; + private Manipulator manipulator = null; + // received ontology as array, used if format=Array(an element of the // array consists of the subject, predicate and object separated by '<' @@ -435,6 +437,11 @@ } public Manipulator getManipulator() { + + if(this.manipulator!=null){ + return this.manipulator; + } + // get Options for Filters if (configurator.getPredefinedManipulator() != null) { return Manipulator.getManipulatorByName(configurator @@ -452,6 +459,11 @@ } } + + public void setManipulator(Manipulator m ){ + this.manipulator = m; + + } public TupleAquisitor getTupleAquisitor() { TupleAquisitor ret = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-05-19 17:23:56
|
Revision: 1759 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1759&view=rev Author: jenslehmann Date: 2009-05-19 17:23:45 +0000 (Tue, 19 May 2009) Log Message: ----------- minor change Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-19 16:49:37 UTC (rev 1758) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/LearnOSMClasses.java 2009-05-19 17:23:45 UTC (rev 1759) @@ -33,6 +33,8 @@ import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; +import org.dllearner.kb.manipulator.StringToResource; +import org.dllearner.kb.manipulator.Rule.Months; import org.dllearner.kb.sparql.Cache; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; @@ -89,6 +91,7 @@ ks.getConfigurator().setInstances(instances); ks.getConfigurator().setPredefinedEndpoint("LOCALGEODATA"); ks.getConfigurator().setSaveExtractedFragment(true); + ks.getManipulator().addRule(new StringToResource(Months.DECEMBER,"http://linkedgeodata.org/vocabulary", 40)); ks.init(); ReasonerComponent reasoner = cm.reasoner(FastInstanceChecker.class, ks); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |