How to display data's property label? I working for dbpedia ontology,
I want to make a sparql query, below is my sample query. This result is mix up either datatype or object type, I want to datatype property name.SELECT ?p ?pLabel ?domain ?range { ?p rdfs:domain http://dbpedia.org/ontology/Person> . }
ex: Following is data type example, but I cannot select only datatype, I want to display type name.
"chat"
'chat'@fr with language tag "fr"
"xyz"^^<http://example.org/ns/userDatatype>
"abc"^^appNS:appDataType
'''The librarian said, "Perhaps you would enjoy 'War and Peace'."'''
1, which is the same as "1"^^xsd:integer
1.3, which is the same as "1.3"^^xsd:decimal
1.300, which is the same as "1.300"^^xsd:decimal
1.0e6, which is the same as "1.0e6"^^xsd:double
true, which is the same as "true"^^xsd:boolean
false, which is the same as "false"^^xsd:boolean
expect to result
Expect to result (only data type)
t开发者_Python百科ypename <- field name
string <- type name
int
boolean
int
double
boolean
How to make a sparql query?
Use function datatype() for that purpose. For example:
select distinct ?y datatype(?z)
{
?x a <http://dbpedia.org/class/yago/JeskolaBuzzUsers>.
?x ?y ?z.
filter (datatype(?z) != '')
}
PREFIX xsd: http://www.w3.org/2001/XMLSchema# ASK WHERE { ?item dm:amount ?amount . FILTER ((datatype(?amount)) != xsd:integer) }
The query engine still knew which ?amount values were integers and which were not, because any unquoted series of digits with no period is treated as an integer. Most of your work with datatypes in SPARQL will involve the use of functions that are covered in more detail in the next section. Before we look at any of those, it’s a good idea to know how representations of typed literals in your queries interact with different kinds of literals in your dataset.
精彩评论