本文介绍了Virtuoso R2RML rr:IRI生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Virtuoso中生成 rr:termType rr:IRI 时遇到问题.我不知道我做错了什么,但是我遵循了W3C规范.

I have a problem with generating rr:termType rr:IRI in Virtuoso. I don't know if am I doing it wrong but I followed the W3C specification.

我的映射如下所示.当我用 CONSTRUCT 语句生成三元组时,我仍然得到"URL" ,但没有得到 IRI =>< url> ( OWNER_LINK BRAND_LINK 列).是Virtuoso不支持的东西,还是我编码方式错误?

My mapping looks like this. When I generate triples with CONSTRUCT statement I still get "URL" but not IRI => <url> (OWNER_LINK and BRAND_LINK columns). Is it something Virtuoso doesn't support or am I coding it the wrong way?

DB.DBA.TTLP
   (  '
        @prefix    rr:  <http://www.w3.org/ns/r2rml#>                                .
        @prefix  foaf:  <http://xmlns.com/foaf/0.1/>                                 .
        @prefix    gr:  <http://purl.org/goodrelations/v1#>                          .
        @prefix     s:  <http://schema.org/>                                         .
        @prefix   pod:  <http://linked.opendata.cz/ontology/product-open-data.org#>  .

        <#TriplesMap3>
           a                 rr:TriplesMap  ;
           rr:logicalTable
              [
                 rr:tableSchema "POD"  ;
                 rr:tableOwner  "DBA"  ;
                 rr:tableName   "BRAND_OWNER_BSIN"
              ];
           rr:subjectMap
              [
                 rr:template  "http://linked.opendata.cz/resource/brand-owner-bsin/{BSIN}"  ;
                 rr:class     gr:BusinessEntity                                             ;
                 rr:graph     <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
              ];
        rr:predicateObjectMap
              [
                 rr:predicate gr:hasBrand  ;
                 rr:objectMap
                    [
                       rr:parentTriplesMap <#TriplesMap4>  ;
                       rr:joinCondition
                          [
                             rr:child "OWNER_CD"   ;
                             rr:parent "OWNER_CD"  ;
              ];    ];    ];
        .


        <#TriplesMap4>
           a                rr:TriplesMap  ;
           rr:logicalTable
              [
                 rr:tableSchema  "POD"          ;
                 rr:tableOwner   "DBA"          ;
                 rr:tableName    "BRAND_OWNER"
              ];
           rr:subjectMap
              [
                 rr:template  "http://linked.opendata.cz/resource/brand-owner/{OWNER_CD}"  ;
                 rr:class     gr:BusinessEntity                                            ;
                 rr:graph     <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
              ];

        rr:predicateObjectMap
           [
              rr:predicate  gr:legalName  ;
              rr:objectMap
                 [ rr:column  "OWNER_NM" ];
           ];
        rr:predicateObjectMap
           [
              rr:predicate  s:url  ;
              rr:objectMap
                 [
                    rr:termType  rr:IRI        ;
                    rr:column    {OWNER_LINK}  ;
           ];    ];
        rr:predicateObjectMap
           [
              rr:predicate  gr:hasBrand  ;
              rr:objectMap
                 [
                    rr:parentTriplesMap  <#TriplesMap3>  ;
                    rr:joinCondition
                       [
                          rr:child   "OWNER_CD"   ;
                          rr:parent  "OWNER_CD"  ;
           ];   ];     ];
        .

        <#TriplesMap2>
           a                rr:TriplesMap;
           rr:logicalTable
              [
                 rr:tableSchema "POD";
                 rr:tableOwner  "DBA";
                 rr:tableName   "BRAND_TYPE"
              ];
           rr:subjectMap
              [
                 rr:template  "http://linked.opendata.cz/resource/brand-type/{BRAND_TYPE_CD}"  ;
                 rr:class     gr:BusinessEntityType                                            ;
                 rr:graph     <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
              ];
           rr:predicateObjectMap
              [
                 rr:predicate  gr:name  ;
                 rr:objectMap
                    [ rr:column  "BRAND_TYPE_NM" ];
              ];
        .


        <#TriplesMap1>
           a                rr:TriplesMap;
           rr:logicalTable
              [
                 rr:tableSchema "POD"   ;
                 rr:tableOwner  "DBA"   ;
                 rr:tableName   "BRAND"
              ];
           rr:subjectMap
              [
                 rr:template  "http://linked.opendata.cz/resource/brand/{BSIN}"  ;
                 rr:class     gr:Brand                                           ;
                 rr:graph     <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
              ];
           rr:predicateObjectMap
              [
                 rr:predicate  pod:bsin               ;
                 rr:objectMap  [ rr:column  "BSIN" ]  ;
              ];
           rr:predicateObjectMap
              [
                 rr:predicate  gr:name                    ;
                 rr:objectMap  [ rr:column  "BRAND_NM" ]  ;
              ];
           rr:predicateObjectMap
              [
                 rr:predicate  s:url  ;
                 rr:objectMap
                    [
                       rr:termType  rr:IRI        ;
                       rr:column    "BRAND_LINK"  ;
              ];    ];

           rr:predicateObjectMap
              [
                 rr:predicate  gr:BusinessEntityType  ;
                 rr:objectMap
                    [
                       rr:parentTriplesMap  <#TriplesMap2>  ;
                       rr:joinCondition
                          [
                             rr:child "BRAND_TYPE_CD"    ;
                             rr:parent "BRAND_TYPE_CD"   ;
              ];    ];    ];
        .
      ',
      'http://product-open-data.org/temp',
      'http://product-open-data.org/temp'
   );

exec ( 'sparql ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('http://product-open-data.org/temp') );

推荐答案

所以我发现我的代码是错误的

So I figured out my code was wrong it should be like this

 rr:predicateObjectMap
    [
       rr:predicateMap
          [
             rr:constant  s:url
          ];
       rr:objectMap
          [
             rr:termType  rr:IRI          ;
             rr:template  "{BRAND_LINK}"  ;
          ];

     ];.

它正在工作

谢谢.

这篇关于Virtuoso R2RML rr:IRI生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 18:30