是否可以在RML/SPARQL映射中使用前缀进行模板定义?

发布于 2025-02-11 10:34:02 字数 1323 浏览 1 评论 0原文

我正在尝试使用 rml映射

我已经弄清楚了如何定义和使用前缀rr:常数定义,如<< ----箭头所示。我还弄清楚了如何使用rr:template映射列值,如<<<<<<<<< arrow中代码。

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix ex: <http://example.org/>.
[...]
:map_001 rr:predicateObjectMap [
             rr:predicate rdf:type; # <<---
             rr:objectMap [
                 rr:constant ex:MyClass; # <<---
                 rr:termType rr:IRI 
                 ]
             ];
         rr:predicateObjectMap [
             rr:predicate ex:myPredicate; # <<---
             rr:objectMap [
                 rr:template "http://example.org/{some_column}" # <<<<<<
                 ]
             ].

我的问题是:是否有可能在rr:template定义中以某种方式使用前缀,以便不必明确编写完整的基础URI?例如,我想做类似下面显示的事情,尽管这显然不起作用:

:map_001 rr:predicateObjectMap [
             rr:predicate ex:myPredicate;
             rr:objectMap [
                 rr:template ex:"{some_column}" # <<--- DOESN'T WORK!
                 ]
             ].

是否有任何语法,还是根本不可能?

I'm trying to map tabular data into RDF using RML mapping.

I've figured out how to define and use prefixes for rr:constant definitions as indicated with the <<--- arrows in the code below. I've also figured out how to map column values using rr:template, as indicated with the <<<<<< arrow in the same code.

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix ex: <http://example.org/>.
[...]
:map_001 rr:predicateObjectMap [
             rr:predicate rdf:type; # <<---
             rr:objectMap [
                 rr:constant ex:MyClass; # <<---
                 rr:termType rr:IRI 
                 ]
             ];
         rr:predicateObjectMap [
             rr:predicate ex:myPredicate; # <<---
             rr:objectMap [
                 rr:template "http://example.org/{some_column}" # <<<<<<
                 ]
             ].

My question is: is it possible to somehow use prefixes in rr:template definitions, in order to not have to explicitly write the complete base URI? For example, I'd like to do something like what is shown below, although this clearly doesn't work:

:map_001 rr:predicateObjectMap [
             rr:predicate ex:myPredicate;
             rr:objectMap [
                 rr:template ex:"{some_column}" # <<--- DOESN'T WORK!
                 ]
             ].

Is there any syntax for this, or is it simply not possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文