sparql

converting freebase MQL to SPARQL

吃可爱长大的小学妹 提交于 2019-12-04 09:05:49
following freebase MQL finds 5 artists and 50 albums for each artists. [{ "type" : "/music/artist", "name":null, "album" : [{ "name" : null, "count":null, "limit":50 }], "limit":5 }] first try - without a subquery I can write SPARQL like this: SELECT ?artist ?album WHERE { ?artist :type :/music/artist . ?artist :album ?album } LIMIT n but, I don't know how many n should be specified because SPARQL has no hierarchy as far as I know. second try - with a sub-query (not sure this works correctly) Following sub-query looks like working. SELECT ?artist ?album WHERE { ?artist :album ?album . { SELECT

Where do I test my queries for my RDF written in SPARQL

人盡茶涼 提交于 2019-12-04 08:05:47
问题 I am a beginner with Semantic Web technologies, My question might be a very basic one but I am really stuck figuring it out. I have a RDF file I created from an XML and have validated it using w3.org RDF VALIDATOR. My question is how can I run queries on my RDF document using SPARQL. The online resource http://demo.openlinksw.com/sparql does not work and I have no Idea what or how to find information about this. 回答1: You could set up your own local SPARQL endpoint using Fuseki. Fuseki is part

What is the difference between DatatypeProperty, ObjectProperty, & FunctionalProperty, and when should I use them?

戏子无情 提交于 2019-12-04 07:48:34
问题 When writing an ontology, there are several very commonly used types, including: DatatypeProperty ObjectProperty FunctionalProperty InverseFunctionalProperty The first three kinda look like they'd be used in a particular set of ways, but I find my idea of them being challenged by how I've seen them used in FOAF. When should each of them be used or not be used? 回答1: The first two of these, DatatypeProperty and ObjectProperty, describe what kind of values a triple with the property should have.

How to get Wikidata labels by ID using SPARQL?

99封情书 提交于 2019-12-04 07:42:01
How can I get the labels in English or any other language in Wikidata by ID using SPARQL endpoint? Suppose wd:Q146190 is your wikidata entity ID get the label in a specific language of your specific entity ID: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT * WHERE { wd:Q146190 rdfs:label ?label . FILTER (langMatches( lang(?label), "EN" ) ) } LIMIT 1 live example in english live example in german get all the labels in any language of your specific entity ID: SELECT * WHERE { wd:Q146190 rdfs:label ?label } here the link to the live try

Query for best match to a string with SPARQL?

徘徊边缘 提交于 2019-12-04 07:40:15
I have a list with movie titles and want to look these up in DBpedia for meta information like "director". But I have trouble to identify the correct movie with SPARQL, because the titles sometimes don't exactly match. How can I get the best match for a movie title from DBpedia using SPARQL? Some problematic examples: My List: "Die Hard: with a Vengeance" vs. DBpedia: "Die Hard with a Vengeance" My List: "Hachi" vs. DBpedia: "Hachi: A Dog's Tale" My current approach is to query the DBpedia endpoint for all movies and then filter by checking for single tokens (without punctuations), order by

Can I combine local and remote dataset within SPARQL query?

北城余情 提交于 2019-12-04 07:24:00
I've been reading about SPARQL and RDF and please correct me if my reasoning about these technologies is wrong here. Assuming that we have a local SPARQL database called LOCAL.. and url to remote RDF file called URL_RDF. Can I write a script lets say in PHP which will do a SPARQL query like this ? Pseudo code. SELECT * FROM LOCAL,URL_RDF WHERE LOCAL.id=URL_RDF.id In other words can I combine sources within SPARQL query like this (remote file + local db) ? You can do this using the federation features in SPARQL 1.1. These are described at http://www.w3.org/TR/sparql11-federated-query , but to

Sparql query running forever

独自空忆成欢 提交于 2019-12-04 07:17:50
I'm struggling with the execution of a SPARQL query in Jena, with a resulting behaviour that I don't understand... I'm trying to query the Esco ontology ( https://ec.europa.eu/esco/download ), and I'm using TDB to load the ontology and create the model (sorry if the terms I use are not accurate, I'm not very experienced). My goal is to find a job position uri in the ontology that matches with the text I have previously extracted: ex: extracted term : " acuponcteur " -> label in ontology: "Acuponcteur"@fr -> uri: < http://ec.europa.eu/esco/occupation/14918 > What I call the "weird behaviour" is

Meaning of square brackets “[]” when querying RDF with SPARQL?

て烟熏妆下的殇ゞ 提交于 2019-12-04 07:11:14
I am pretty new to SPARQL and RDF and I was wondering what exactly does the below mean in SPARQL? [] vc:n ?vcard . The complete query is PREFIX vc: <http://www.w3.org/2006/vcard/ns#> SELECT ?given ?family WHERE{ [] vc:n ?vcard . OPTIONAL {?vcard vc:given-name ?given .} OPTIONAL {?vcard vc:family-name ?family .} } Joshua Taylor This is cannibalized from my answer to What are brackets in SPARQL and why is the linked movie database limited to 2500 records? , of which this question may be a duplicate, although it's a bit more broad. (It asks two questions, whereas this asks just one.) The answer

HttpException error when I call SPARQL query (on DBPedia) in Java Code

喜欢而已 提交于 2019-12-04 06:58:04
问题 I have a problem with SPARQL endpoint using Java Code. In particular, I have this Java Class: public class example { public static void main(String[] args) { String value = "http://dbpedia.org/resource/Fred_Guy"; example exam = example(); QueryExecution qe = exam.query(value); ResultSet results = ResultSetFactory.copyResults( qe.execSelect() ); } public QueryExecution query(String stringa){ ParameterizedSparqlString qs = new ParameterizedSparqlString( "" + "prefix dbpediaont: <http://dbpedia

Measuring distances among classes in RDF/OWL graphs

被刻印的时光 ゝ 提交于 2019-12-04 06:47:05
Maybe someone could give me a hint. Is it possible to measure the distance between 2 concepts/classes that belong to the same ontology? For example, let's suppose I have an ontology with the Astronomy class and the Telescope class. There is a link between both, but it is not a direct link. Astronomy has a parent class called Science, and Telescope has a parent class called Optical Instrument which belongs to its parent called Instrumentation, that is related to a class called Empirical Science that finally belongs to a class called Science. So there is an indirect link between Telescope and