SPARQL select optional with language

后端 未结 3 1469
礼貌的吻别
礼貌的吻别 2021-02-07 04:08

I have some triples that look like this:

test:thing rdfs:label \"Non-Language Label\"
test:thing rdfs:label \"English Label\"@en
test:thing rdfs:label \"French L         


        
3条回答
  •  北海茫月
    2021-02-07 04:29

    PREFIX rdfs:  
    SELECT ?uri ?label ?preferredLabel
    WHERE 
    {
      {
       ?uri rdfs:label ?label . FILTER(LANG(?label) = "" && regex(str(?label), '(^|\\\\W)fr', 'i'))
      }
      UNION
      {
       ?uri rdfs:label ?preferredLabel . FILTER(LANG(?preferredLabel) = "fr" && regex(str(?preferredLabel), '(^|\\\\W)fr', 'i'))
      }
    }
    

提交回复
热议问题