Notation3 rules using language tags

34 views Asked by At

I have facts expressed in Turtle/Notation3 syntax that use language tags for localization of strings, e.g.

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ex: <http://www.example.org/#>.

ex:A rdfs:label "example"@en;
   rdfs:label "beispiel"@de.

Is it possible and if so, how could one define rules specific to a given language tag?

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ex: <http://www.example.org/#>.

{
  ?s rdfs:label ?v@en. # a mechanism is needed here to select for 'en' lang tag
}
=>
{
  ?s a ex:EnglishLabeledThing.
}.

Thanks for your help ;)

I tried various variations of the above syntax, accessing properties of langString or LocalizableString but did not came up with a solution. Also I could not find any explanation in the N3 specs. I'm using EYE v2.3.0.

1

There are 1 answers

0
florian k On

For future reference, I came up with a solution by using func (http://www.w3.org/2007/rif-builtin-function#):

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ex: <http://www.example.org/#>.
@prefix func: <http://www.w3.org/2007/rif-builtin-function#>.

{
  ?s rdfs:label ?v.
  (?v) func:lang-from-PlainLiteral ?l.
  (?l "en") func:compare 0.
}
=>
{
  ?s a ex:EnglishLabeledThing.
}.

results in ex:A a ex:EnglishLabeledThing. as expected, however I also came across the pred:matches-language-range which might be a better fit here.