What is the lang function in SPARQL?

Suzan Cioc

Among the SPARQL Query Examples, there is a query for US presidents and spouses:

PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?p ?w ?l ?wl WHERE {
  wd:Q30 p:P6/v:P6 ?p .
  ?p wdt:P26 ?w .
  OPTIONAL  {  
    ?p rdfs:label ?l filter (lang(?l) = "en") . 
  }
  OPTIONAL {
    ?w rdfs:label ?wl filter (lang(?wl) = "en"). 
  }
}

It contains function-like syntax, lang(?l), which is intended to filter by language.

How does this work? Is this a special function of Blazegraph? Or are different languages stored as normal values in RDF graphs?

How can I store data this way, so that it will be retrieved with the lang function correctly?

May I have my own function to have ND predicates, like probability(?a) > 0.8?

mb21

lang is a native SPARQL operator (see the standard) which returns the language tag of an RDF literal (e.g. the EN in ?p foaf:name "Robert"@EN.).

Some SPARQL engines support the ability to implement custom functions. See for example this tutorial for Sesame and this for Blazegraph.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

what is wrong with SPARQL query?

From Dev

year() function in SPARQL

From Dev

property function extension sparql

From Dev

year() function in SPARQL

From Dev

property function extension sparql

From Dev

What is this error? related to SPARQL.

From Dev

Sparql multi lang data compression to one row

From Dev

What's the meaning of hash sign (#) in SPARQL?

From Dev

What is the scope of "values" in SPARQL query graph

From Dev

What does slash mean in a SPARQL property path?

From Dev

What is the recommended way for adding individuals with SPARQL UPDATE?

From Dev

SPARQL Regex does not show what is supposed to show

From Dev

Debugging sparql function return values in dotNetRDF

From Dev

Use COUNT inside a CONSTRUCT function in SPARQL

From Dev

Uncaught TypeError: lang is not a function

From Dev

Uncaught TypeError: lang is not a function

From Dev

What SPARQL term can I use to reference a Wikipedia category

From Dev

What is the difference between UNION and EXISTS filters in a SPARQL query

From Dev

What SPARQL query can return item by its label and description text?

From Dev

What is "into" function for?

From Dev

What is "into" function for?

From Dev

What is the address space in Go(lang)?

From Dev

What is the function of this function here?

From Dev

What is the difference between function and function*

From Dev

`[Function]` and `[Function: Object]` - what is difference?

From Dev

What is the difference between function and function*

From Dev

what give java.lang.NoClassDefFoundError?

From Dev

What is the java.lang.Integer retained size?

From Dev

What does the {lang:(?:da|en)} do in Javascript?

Related Related

HotTag

Archive