sparql

How to return all S->P->O triples from a starting resource to a specified path depth?

狂风中的少年 提交于 2019-12-09 19:29:13
问题 My goal is to graphically represent the S->P->O relations within a depth two edges from the specified resource, p:Person_1 . I want all relations within that path length to be returned from my query as ?s, ?p, ?o for further processing in my graphical application. I tried the first query below which gives me my first set of ?s ?p ?o with repeats, then ?p2, ?o2, ?p3, ?o3 as additional columns in the result. I want to bind ?p2 and ?p3 to ?p , ?o2 and ?o3 to ?o . SELECT * WHERE { p:Person_1 ?p

Query for best match to a string with SPARQL?

你。 提交于 2019-12-09 18:22:38
问题 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

SPARQL Optional query

Deadly 提交于 2019-12-09 17:33:01
问题 I have RDF in turtle format in this following @prefix ab: <http://learningsparql.com/ns/addressbook#> . @prefix d: <http://learningsparql.com/ns/data#> . d:i0432 ab:firstName "Richard" . d:i0432 ab:lastName "Mutt" . d:i0432 ab:homeTel "(229) 276-5135" . d:i0432 ab:nick "Dick" . d:i0432 ab:email "richard49@hotmail.com" . d:i9771 ab:firstName "Cindy" . d:i9771 ab:lastName "Marshall" . d:i9771 ab:homeTel "(245) 646-5488" . d:i9771 ab:email "cindym@gmail.com" . d:i8301 ab:firstName "Craig" . d

How to recursively expand blank nodes in SPARQL construct query?

雨燕双飞 提交于 2019-12-09 14:57:36
问题 There is probably an easy to answer to this, but I can't even figure out how to formulate the Google query to find it. I'm writing SPARQL construct queries against a dataset that includes blank nodes. So if I do a query like CONSTRUCT {?x ?y ?z .} WHERE {?x ?y ?z .} Then one of my results might be: nm:John nm:owns _:Node Which is a problem if all of the _:Node nm:has nm:Hats triples don't also get into the query result somehow (because some parsers I'm using like rdflib for Python really don

Why use owl:Restriction as own:EquivalenceClass's property?

狂风中的少年 提交于 2019-12-09 13:19:23
问题 I just start to learn Semantic Web and have a question about restriction class. I dug a while but haven't found any answer yet.. Any help would be much appreciated! From text book, I see examples of define restriction class, they are all about to define a anonymous owl:Restriction class bnode and link this bnode with property owl:equivalentClass . example: example:restrictionClass owl:equivalentClass [ rdf:type owl:Restriction; owl:onProperty example:resProp; owl:someValuesFrom example

Return a nested data structure from a SPARQL query

倖福魔咒の 提交于 2019-12-09 11:27:03
问题 If I have a graph with this kind of structure: @prefix : <http://example/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . :alice rdf:type foaf:Person . :alice foaf:givenName "Alice" . :alice foaf:familyName "Liddell" . :bob rdf:type foaf:Person . :bob foaf:givenName "Bob" . :bob foaf:familyName "Doe" . :choi rdf:type foaf:Person . :choi foaf:givenName "Hwa" . :choi foaf:familyName "Choi" . :alice :knows :bob, :choi . How do I obtain

How to get started with RDF? (Particularly for relational database developers?)

我的未来我决定 提交于 2019-12-09 06:30:23
问题 I am putting together a catalog (catalogs by nature are just metadata), and so rather than using a database, I am using an RDF store and SPARQL processor to compile the data. I am at the pattern-matching stage (the fun part). So, I get to come up with lots of patterns that are simple to define in SPARQL, and then provide that information to the people who use the catalog. Ok, here's my question: I have worked on a few projects using RDF, and it seems like getting started is the hardest part

Finding shortest path with SPARQL query

走远了吗. 提交于 2019-12-09 06:27:24
问题 I am trying to understand the computational limitations of the SPARQL query, and I would like know how to write a query that will determine if there is a directed path between two objects. I know a way to do it for a path of a specific length: SELECT ?a ?b ?c ?d WHERE { ?a <http://graphtheory/hasNeighbor> ?b . ?b <http://graphtheory/hasNeighbor> ?c . ?c <http://graphtheory/hasNeighbor> ?d . FILTER (?a != ?c && ?b != ?d && ?a = <http://graphtheory/node/1> && ?d = <http://graphtheory/node/2>) }

Group concat not working

余生颓废 提交于 2019-12-09 03:23:12
问题 I've written a query without using group_concat and get 9 rows returned, one row for each occupation that Einstein held. When I add group_concat on the occupation column, that column is null. I don't understand what I'm doing wrong here. What I expect to see is 1 row with all 9 occupations in the occupations column. Here is the simple query. SELECT ?item ?itemLabel ?genderLabel (GROUP_CONCAT(?occupationLabel) AS ?occupations) WHERE { ?item wdt:P31 wd:Q5. ?item ?label "Albert Einstein"@en.

Open world assumption and SPARQL in triple stores

六眼飞鱼酱① 提交于 2019-12-08 20:56:30
I would like to know if SPARQL, by default, adopts the open world assumption or if this depends on the triple stores that execute the SPARQL queries. And what are the implications of this assumption in queries. Best regards. Well.... I wonder whether this is really a good question for this site. I think not, but I'm gonna throw a few cents into the bucket anyway. To start with -- does it matter whether SPARQL "adopts" (and what does that mean, to you?) OWA, and, if so, why? Then, to address @AKSW's comment -- W3 differs with @AKSW's assertion, in at least the RDF 1.0 Spec (granted, that has