sparql

SPARQL: How to obtain label in available languages if first option is not available

江枫思渺然 提交于 2019-12-05 10:20:05
If a Wikidata resource returned by my query has no available label in the language I filtered for I obtained an empty cell. SELECT * WHERE { ?country wdt:P31 wd:Q6256. ?country rdfs:label ?country_name FILTER(LANG(?country_name) = 'jbo'). } link How to request to have a label returned in one of any of the available languages if the first language fails? Joshua Taylor First, prefer langMatches for checking language tags. This is especially important in your case, since you might want, for instance, a label in English, and langMatches(lang(?label), "en") will find a label with the tag "en", or

Fuseki GC overhead limit exceeded during data import

懵懂的女人 提交于 2019-12-05 09:42:31
I'm trying to import LinkedMDB (6.1m triples) into my local version of jena-fuseki at startup: /path/to/fuseki-server --file=/path/to/linkedmdb.nt /ds and that runs for a minute, then dies with the following error: Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded at com.hp.hpl.jena.graph.Node$3.construct(Node.java:318) at com.hp.hpl.jena.graph.Node.create(Node.java:344) at com.hp.hpl.jena.graph.NodeFactory.createURI(NodeFactory.java:48) at org.apache.jena.riot.system.RiotLib.createIRIorBNode(RiotLib.java:80) at org.apache.jena.riot.system.ParserProfileBase

Add text search where clause to SPARQL query

最后都变了- 提交于 2019-12-05 08:52:07
I have been given what I thought would be a simple task - take an existing SPARQL query and adapt the WHERE clause to restrict results to entities where a specific text field contains a specific search term. However, I am entirely new to the SPARQL language and nothing I've tried is working. It seems I need to use the text:query (rdfs:label 'word' 10) syntax, but I haven't managed to successfully integrate this into the query below. What I need is to further filter the results of the below query where the rdfs:label triple has a value containing the search term. If any of you could provide

Retrieving data from geonames using SPARQL

我怕爱的太早我们不能终老 提交于 2019-12-05 08:08:50
问题 I am trying to get linked data from geonames in the following SPARQL, but obviously I'm doing someting wrong. prefix oxprop: <http://ophileon.com/ox/property#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> prefix wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#> select ?poi ?poiname ?geonames ?latitude from <http://www.ophileon.com/ox/poi.rdf> # from <http://sws.geonames.org/ > where { ?poi rdfs:label ?poiname. ?poi owl:sameAs ?geonames.

Getting a list of American physicists from DBpedia using SPARQL

十年热恋 提交于 2019-12-05 08:05:11
I want to query the American Physicsts and get the list of physicists. How can I do this? The SPARQL you need would look like this .... PREFIX category: <http://dbpedia.org/resource/Category:> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT * WHERE { ?s dcterms:subject category:American_physicists . } see results here If you want the list with some extra predicates you need to join more triple patterns using the variable ?s . For instance, to retrieve the birthdate for each physicist ... PREFIX category: <http://dbpedia.org/resource/Category:> PREFIX dcterms: <http://purl.org/dc/terms/>

Multiple SPARQL “INSERT WHERE” queries in a single request

让人想犯罪 __ 提交于 2019-12-05 04:28:55
My question is similar to what was asked on this thread Is it possible to combine those 2 SPARQL INSERT into one? I want to have multiple INSERT WHERE statements in a query, but for different subjects. I will like to test a particular value ("testValueN") and if present would like to insert a new triple for that subject. An example of it would be, PREFIX Sensor: <http://example.com/Equipment.owl#> { INSERT { ?subject1 Sensor:test2 'newValue1' . } WHERE { ?subject1 Sensor:test1 'testValue1' . } }; { INSERT { ?subject2 Sensor:test2 'newValue2' . } WHERE { ?subject2 Sensor:test1 'testValue2' . }

SPARQL query rdf container (rdf: Bag)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 03:46:01
I have this RDF <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:com="http://www.example.com/com#"> <rdf:Description rdf:about="http://www.example.com/com#1"> <com:cities> <rdf:Bag> <rdf:li>A</rdf:li> <rdf:li>B</rdf:li> <rdf:li>D</rdf:li> </rdf:Bag> </com:cities> <com:name>1</com:name> </rdf:Description> <rdf:Description rdf:about="http://www.example.com/com#2"> <com:cities> <rdf:Bag> <rdf:li>C</rdf:li> <rdf:li>B</rdf:li> </rdf:Bag> </com:cities> <com:name>2</com:name> </rdf:Description> <rdf:Description rdf:about="http://www.example

SPARQL: Get all the entities of subclasses of a certain class

ε祈祈猫儿з 提交于 2019-12-05 00:44:18
I've to get all the instances of a class C and subclasses (direct or indirect) of C, in SPARQL. I can get all the direct subclasses of C in this way: SELECT ?entity WHERE { ?subclass rdfs:subClassOf :C . ?entity rdf:type ?subclass . } But I can't get the instances of an indirect subclass and neither any instance of C. As I know (I've pre-calculated them) all the subclasses (direct and indirect of C), and I can build a dynamic query, is it possible build a query like the following one? SELECT ?entity WHERE { ?entity rdf:type in <list>. } Thanks to everyone. EDIT: I've just solved it, even if in

SPARQL - Select the most relevant category of a dbpedia resource

淺唱寂寞╮ 提交于 2019-12-04 22:49:43
问题 I've a dbpedia resource and I'd like to obtain all the dbpedia categories associated. For this purpose I wrote this SPARQL query SELECT ?p ?o WHERE { <http://dbpedia.org/resource/Rihanna> ?p ?o . } focusing only on http://purl.org/dc/terms/subject property. The results I've is a set of categories. Which could be a good manner to select the most relevant category which describes Rihanna singer? 回答1: This query orders Rihanna's categories by the total number of members in each category: SELECT

How to display alert box when no json value is given

戏子无情 提交于 2019-12-04 21:21:22
I have displayed the result of a SPARQL query in a HTML page using Json, my question is when a certain value is entered and the query does not display a result it should display a alert box. My code is below: HTML <table id="results"> </table> Query script var query = [ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>", "PREFIX yago: <http://dbpedia.org/class/yago/>", "PREFIX type: <http://dbpedia.org/class/yago/>", "PREFIX prop: <http://dbpedia.org/property/>", "SELECT ?name ?runtime", "WHERE {", "?film rdf:type dbo:Film.", "?film dbp:name ?name.", "?film dbo:director dbr:Peter_Jackson."