在rdf/n3文件中按名称搜索 [英] Search by name in rdf/n3 file

查看:118
本文介绍了在rdf/n3文件中按名称搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在turtle/n3文件中执行一些过滤,并返回另一个相同类型的文件. 我正在处理的基本数据元素(位置)是这样:

I have to perform some filtering in a turtle/n3 file, returning another file of the same kind. The basic data element (location) i work on is this:

:pt0001
     vcard:category "Poste e Telegrafi"
    ; vcard:fn "Ufficio Bologna 1"
    ; vcard:extended-address "Via Cairoli 9, Bologna BO, Italy"
    ; vcard:latitude "44.504192"
    ; vcard:longitude "11.338661"
    ; vcard:tel "051 243425"
    ; vcard:fax "051 244459"
    ; cs:opening "Mon, Tue, Wed, Thu, Fri: 0800-1330. Sat: 0800-1230."
    ; cs:closing "01-01, 01-06, P, LA, 04-25, 05-01, 06-02, 08-15, 11-01, 12-08, 12-25, 12-26: .".

例如,我想搜索具有特定名称,纬度或类别的元素(ptxxxx).我已经被建议在查询中使用Construct来从rdf中检索三元组,因此我可以将它们添加到我正在构建的新图形/rdf中.事实是,如果我使用正则表达式过滤器功能对三元组进行过滤以按(不区分大小写)名称进行搜索,那么在这种情况下,我只会得到一个三元组来定义我要寻找的名称.例如,是否可以搜索名称为(谓词)"Ufficio Bologna 1"(对象)的主题(ptxxxx)?

I want, for example, to search for elements (ptxxxx) that have a certain name or latitude or category. I have already been advised to use construct in the query to retrieve triples from the rdf, so I can add them to a new graph/rdf that I am building. The fact is that if I filter over triples to search by (case insensitive) name with the regex filter function, I only get one triple that defines in this case the name I was looking for. Is it possible to search for the subject (ptxxxx) whose name is (predicate) "Ufficio Bologna 1" (object), for example?

推荐答案

我这样解决:

CONSTRUCT {?s ?p ?o}
        WHERE {
                ?s ?p ?o;
                vcard:fn ?name.
                FILTER regex (?name ,"^ufficio bologna 1$", "i")
                }

这篇关于在rdf/n3文件中按名称搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆