Skip to content

Instantly share code, notes, and snippets.

@tatiana
Last active December 15, 2015 00:08
Show Gist options
  • Save tatiana/5170442 to your computer and use it in GitHub Desktop.
Save tatiana/5170442 to your computer and use it in GitHub Desktop.
Why adding transitivity breaks language filter in SPARQL Query?
@prefix tpedia: <http://tatipedia.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
tpedia:new_york a tpedia:Place ;
rdfs:label "Nova Iorque"@pt ;
rdfs:label "New York"@en .
tpedia:london a tpedia:Place ;
rdfs:label "Londres"@pt ;
rdfs:label "London"@en .
tpedia:name rdf:type owl:DatatypeProperty ;
rdfs:subPropertyOf rdfs:label .
tpedia:munich a tpedia:Place ;
tpedia:name "Munique"@pt ;
tpedia:name "Munich"@en .
@tatiana
Copy link
Author

tatiana commented Mar 19, 2013

The issue was solved using inference.

First, we need to add the inference rule using the Virtuoso ISQL:

rdfs_rule_set ('http://tatipedia.org/property_ruleset', 'http://tatipedia.org');

After this, the query bellow will work as expected:

DEFINE input:inference <http://tpedia.org/property_ruleset>
SELECT DISTINCT ?subject ?label
WHERE {
    ?subject a <http://tatipedia.org/Place>;
             rdfs:label ?label  .
    FILTER (langMatches(lang(?label), "pt"))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment