sparql

UNION and intersection using SPARQL queries

末鹿安然 提交于 2020-01-15 07:22:06
问题 I am converting user-defined-queries into SPARQL. For example, when user says, "abc", it means give me all nodes of a given type which have some attribute named "abc". As an extension of this, if user says, "abc or (pqr and lmn)", I need to find all nodes of a given type for which some attribute is "abc or (pqr and lmn)". Following is the query I have come up with: SELECT DISTINCT ?node, ?type WHERE { { ?node a ?type . FILTER ( ?type != <sometype>) } { { ?node ?reln0 ?obj0 . FILTER ( regex

How do you create a Fuseki SPARQL server using the Apache Jena Java API?

回眸只為那壹抹淺笑 提交于 2020-01-15 04:10:09
问题 I am trying to create a Fuseki SPARQL server on my machine. The documentation on the Jena website describes how to create such a server from the command-line, here: http://jena.apache.org/documentation/serving_data/. I am looking for a way of creating and initializing such a server just using the Jena Java API. I have looked over the Jena API but have not made any progress in working out how to proceed. Has anyone done this before? 回答1: Yes this is possible but it is not how Fuseki was

Search in a multilingual database for terms that have not been translated into a specific language

痞子三分冷 提交于 2020-01-14 14:48:07
问题 My query in a multilingual thesaurus looks like this: select (COUNT(?label) as ?pCount) where {?term <http://www.w3.org/2004/02/skos/core#prefLabel> ?label FILTER(langMatches(lang(?label), "DE"))} I get a huge number of concepts with their German translation, which is what I expect from this query. I'm now looking for a query giving me all concepts without any German translation, that is all which have no "prefLabel" with "@de". How would such a query look like? 回答1: You want either FILTER

DBpedia SPARQL filter does not apply to all results

六月ゝ 毕业季﹏ 提交于 2020-01-14 13:55:08
问题 A FILTER NOT EXISTS allows some results through when combined with OPTIONAL triples. My query: SELECT DISTINCT * WHERE { { ?en rdfs:label "N'Djamena"@en . BIND("N'Djamena" AS ?name) . } UNION { ?en rdfs:label "Port Vila"@en . BIND("Port Vila" AS ?name) . } UNION { ?en rdfs:label "Atafu"@en . BIND("Atafu" AS ?name) . } FILTER NOT EXISTS { ?en rdf:type skos:Concept } . OPTIONAL { ?en owl:sameAs ?es . FILTER regex(?es, "es.dbpedia") . } OPTIONAL { ?en owl:sameAs ?pt . FILTER regex(?pt, "pt

DBpedia SPARQL filter does not apply to all results

廉价感情. 提交于 2020-01-14 13:54:27
问题 A FILTER NOT EXISTS allows some results through when combined with OPTIONAL triples. My query: SELECT DISTINCT * WHERE { { ?en rdfs:label "N'Djamena"@en . BIND("N'Djamena" AS ?name) . } UNION { ?en rdfs:label "Port Vila"@en . BIND("Port Vila" AS ?name) . } UNION { ?en rdfs:label "Atafu"@en . BIND("Atafu" AS ?name) . } FILTER NOT EXISTS { ?en rdf:type skos:Concept } . OPTIONAL { ?en owl:sameAs ?es . FILTER regex(?es, "es.dbpedia") . } OPTIONAL { ?en owl:sameAs ?pt . FILTER regex(?pt, "pt

Query DBpedia to get meta-data for Books

江枫思渺然 提交于 2020-01-14 12:39:51
问题 I have a bunch of ISBN's. I want to query DBpedia and get the meta-data of the books. I am unable to understand the SPARQL . Can someone tell me how can I get the meta-data of a book from DBpedia in Java? 回答1: SPARQL is both a query language and a protocol to query so-called SPARQL endpoints . A SPARQL query that asks DBpedia for a book (or books) that have the ISBN 0-553-05250-0, and its (or their) associated properties and values is this: select distinct ?book ?prop ?obj where { ?book a dbo

Why does my SPARQL query duplicate results?

雨燕双飞 提交于 2020-01-14 04:40:28
问题 I am doing some searching, and learning more about SPARQL, but it is not easy like SQL. I just want to know why my query duplicates result and how to fix it. This is my SPARQL Query: PREFIX OQ:<http://www.owl-ontologies.com/Ontology1364995044.owl#> SELECT ?x ?ys ?z ?Souhaite WHERE { ?y OQ:hasnameactivite ?x. ?y OQ:AttenduActivite ?Souhaite. ?y OQ:SavoirDeActivite ?z. ?y OQ:hasnamephase ?ys. ?y OQ:Activitepour ?v. ?ro OQ:hasnamerole ?nr. ?y OQ:avoirrole ?ro. FILTER regex (?nr ,"Concepteur").

Get alias values from wikidata for a given property?

对着背影说爱祢 提交于 2020-01-14 03:25:15
问题 For a given property like 'occupation (P106)', I want to retrieve all its aliases like: profession, job, work, career, employment, craft. All of this is present on the properties wikidata page, under 'Also known as'. How can I go about retrieving this using SPARQL? I tried using the following query. SELECT ?predicate ?object WHERE { wdt:P106 wdt:P1449 ?predicate . //Nickname wdt:P106 wdt:P734 ?predicate . //Family Name wdt:P106 wdt:P735 ?predicate . //Given Name wdt:P106 skos:altLabel

sparql complete tree from subject

别说谁变了你拦得住时间么 提交于 2020-01-13 06:00:29
问题 When I have for example a person graph e.g. John and john has a work adress home adress phone numbers relations etc. Is it possible to retrieve everything that is connected to john and to the subclasses of john without knowing what it is? So that I can retrieve for example the following John < address < house_number < mobile_number < company < address < function < office number < etc... And retrieve this via: "John" rdfs:everything ?everything ... as deep as the tree goes. Or do I need to

sparql complete tree from subject

老子叫甜甜 提交于 2020-01-13 06:00:09
问题 When I have for example a person graph e.g. John and john has a work adress home adress phone numbers relations etc. Is it possible to retrieve everything that is connected to john and to the subclasses of john without knowing what it is? So that I can retrieve for example the following John < address < house_number < mobile_number < company < address < function < office number < etc... And retrieve this via: "John" rdfs:everything ?everything ... as deep as the tree goes. Or do I need to