简体   繁体   English

使用 dbpedia sparql 从位置名称获取经纬度坐标

[英]Get lat and long coordinates from location name using dbpedia sparql

I'm performing entity linking from a Python script from babelfy endpoint .我正在执行来自babelfy endpoint的 Python 脚本的实体链接。 When it is performed, I have an entity with two, one or none entries to a knowledge base: babe.net and dbpedia.执行时,我有一个实体,其中包含两个、一个或没有知识库条目:babe.net 和 dbpedia。

Once I have this, I want to get the latitude and longitude coordinates of the entity place I have just received.一旦我有了这个,我想得到我刚刚收到的实体地点的经纬度坐标。 What is the best way to achieve this?实现这一目标的最佳方法是什么?

I have been reading some options and I think that a solid way of having this done is doing a Python request to dbpedia sparql endpoint .我一直在阅读一些选项,我认为完成此操作的可靠方法是向dbpedia sparql endpoint发出 Python 请求。 However I'm completely new to SPARQL and I don't know how I could, by giving the place name or more easily the entity entry, get those lat and long coordinates.但是,我是 SPARQL 的新手,我不知道如何通过提供地名或更轻松地输入实体条目来获取那些纬度和经度坐标。

For example, given this real output, how should be the SPARQL query to get the coordinates?例如,给定这个真实的 output,SPARQL 查询应该如何获取坐标?

You want the geo.lat and geo.long entries from the dbpedia entry.您需要 dbpedia 条目中的geo.latgeo.long条目。

A simple sparql to get those would be一个简单的 sparql 来获得这些将是

select ?name ?lat ?long 
where {
        ?s rdfs:label ?name.
        ?s geo:lat ?lat.
        ?s geo:long ?long.
       }

You might have to fiddle about with including the appropriate PREFIX details for rdfs and geo but reading around should sort that out.您可能需要为rdfsgeo添加适当的PREFIX详细信息,但仔细阅读应该可以解决这个问题。 The specs for geo can be found here: https://www.w3.org/2003/01/geo/#vocabulary geo的规范可以在这里找到: https://www.w3.org/2003/01/geo/#vocabulary

Run as above, the endpoint should report all entities in dbpedia tagged with latitude and longitude details.如上运行,端点应报告 dbpedia 中标记有纬度和经度详细信息的所有实体。

If you wanted to apply a filter on the label name (ie to enact a search for something specific), that would be done by adding an additional filter on ?s rdfs:label "Madrid".如果您想对 label 名称应用过滤器(即对特定内容进行搜索),可以通过在?s rdfs:label "Madrid". for example.例如。

Similarly, if you wanted to query directly using the entity URI, then just replace references to the ?s in the query with the specific URI you want, or add the line:同样,如果您想直接使用实体 URI 进行查询,则只需将查询中对?s的引用替换为您想要的特定 URI,或添加以下行:

BIND (<http://dbpedia.org/resource/Madrid> AS ?s)

To set the ?s variable to be something specific and retrieve the details of just that entry.?s变量设置为特定的内容并检索该条目的详细信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 sparql 查询从 dbpedia 获取导演的电影列表 - How can I get the list of movies by a director from dbpedia using sparql query 使用KMeans算法和Python对地理位置坐标(纬度,长对)进行聚类 - Clustering geo location coordinates (lat,long pairs) using KMeans algorithm with Python 使用tweepy从已识别的推文中获取经/纬度坐标; 获取KeyError:“坐标” - Getting lat/long coordinates from identified tweets using tweepy; getting KeyError: 'coordinates' 如何从使用numpy arange生成的坐标列表生成坐标列表(lat,long) - How do I generate a list of coordinates (lat, long) from list of coordinates generated using numpy arange 如何使用经纬度获取用户当前位置 - How to get user current location with lat and long 使用python和gdal从.geotiff中的像素点查找纬度/经度坐标 - Find lat/long coordinates from pixel point in .geotiff using python and gdal 使用 python 和 gdal 从 lat/long 点 in.geotiff 查找像素坐标 - Find pixel coordinates from lat/long point in .geotiff using python and gdal 如何从python中的2个numpy数组中提取经度/纬度坐标? - How to extract lat / long coordinates from 2 numpy arrays in python? 从CA状态平面坐标到Lat的PyProj转换,Long不是预期的 - PyProj transformation from CA state plane coordinates to Lat, Long not as expected 从 OSMNX Geoseries 获取坐标列表(纬度、经度) - Getting list of coordinates (lat,long) from OSMNX Geoseries
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM