From: <jen...@us...> - 2009-04-01 11:59:26
|
Revision: 1678 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1678&view=rev Author: jenslehmann Date: 2009-04-01 11:59:16 +0000 (Wed, 01 Apr 2009) Log Message: ----------- simple match finder for Auerbachs Keller Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java Added 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-04-01 11:17:54 UTC (rev 1677) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-04-01 11:59:16 UTC (rev 1678) @@ -19,7 +19,12 @@ */ package org.dllearner.scripts.matching; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.net.URI; +import java.net.URL; +import java.net.URLConnection; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; @@ -36,13 +41,15 @@ */ public class DBpediaLinkedGeoData { - public static void main(String[] args) { + public static void main(String[] args) throws IOException { // we start from the DBpedia URI and try to find the corresponding // OSM URI (assuming that each location having coordinates in Wikipedia also // exists in OSM) URI dbpediaURI = URI.create("http://dbpedia.org/resource/Auerbachs_Keller"); + int distanceThresholdMeters = 100; + // use official DBpedia endpoint (switch to db0 later) SparqlEndpoint endpoint = SparqlEndpoint.getEndpointDBpedia(); SPARQLTasks st = new SPARQLTasks(endpoint); @@ -60,6 +67,27 @@ System.out.println("lat: " + geoLat + ", long: " + geoLong); + URL linkedGeoDataURL = new URL("http://linkedgeodata.org/triplify/near/"+geoLat+","+geoLong+"/"+distanceThresholdMeters); + + // TODO: replace by SPARQL query + + URLConnection conn = linkedGeoDataURL.openConnection(); + BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); + StringBuffer sb = new StringBuffer(); + String line=""; +// int pointID = 0; + while ((line = rd.readLine()) != null) + { + if(line.contains("Auerbach")) { + System.out.println(line); + } + + sb.append(line); + } + rd.close(); + +// System.out.println(sb.toString()); + } } Added: trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java 2009-04-01 11:59:16 UTC (rev 1678) @@ -0,0 +1,96 @@ +/** + * 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; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |