2014-11-08 51 views
1

我在Virtuoso中生成rr:termTyperr:IRI時遇到問題。我不知道我是否做錯了,但我遵循W3C規範。Virtuoso R2RML rr:IRI生成

我的映射看起來像這樣。當我使用CONSTRUCT聲明生成三元組時,我仍然得到"URL"但不是IRI => <url>OWNER_LINKBRAND_LINK列)。這是Virtuoso不支持的東西,還是我編碼錯了?

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')); 

回答

1

所以我想通了,我的代碼是錯誤的,應該是這樣的

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

    ];. 

,它的工作

謝謝。

1

需要明確的是 - 你說的R2RML映射成功加載,但運行SPARQL CONSTRUCT查詢時,不顯示在結果中rr:termType rr:IRI映射設置?

As the docs indicate,只有rr:sqlQuery目前不支持......

+0

是的我沒有得到任何結果集你知道我在做什麼錯嗎?在與Virtuoso合作時,我真的感到很沮喪 – James 2014-11-10 23:03:26