sparql

Grouping SPARQL results for the same property?

故事扮演 提交于 2019-12-07 14:37:16
问题 I have the following SPARQL query: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> SELECT ?subsidiary ?employees WHERE { <http://dbpedia.org/resource

Find the two nearest neighbors of points

我怕爱的太早我们不能终老 提交于 2019-12-07 12:39:14
问题 I want to find the two nearest neighbors of each point dataset : :p1 :has_position 1 . :p2 :has_position 2 . :p3 :has_position 3 . :p4 :has_position 4 . expected results : ?POINT ?NEIGHBORS "p1" "p2; p3" "p2" "p1; p3" "p3" "p2; p4" "p4" "p2; p3" I try something like this : SELECT ?POINT ?POS (group_concat(?idPointN;separator='; ' )as ?NEIGHBORS) WHERE{ ?idPoint :has_position ?POS . ?idPointN :has_position ?POSN . FILTER (?idPoint != ?idPointN) } GROUP BY ?POINT ?POS this return all the

How can we create custom template using grmm inbuilt class in mallet?

一笑奈何 提交于 2019-12-07 11:55:17
问题 I am new to mallet and currently working on Sparql query optimization using template based model. For this i wanted to create a template model from RDf graph. The three templates which i want to create is class, attribute and relation. i have come across this tool called mallet which can help me to create a template. but still i am not getting an idea how can i do so using ACRF.Template in grmm.Can someone please give me guidelines about the template creation using mallet. See the below image

SPARQL parameterized queries

随声附和 提交于 2019-12-07 09:48:31
问题 Good day! I apply rdflib for python. I have a question. How can I put variable into SPARQL's query ? Instead of 'OSPF' in course:OSPF! qres = g.query( """SELECT ?x ?z ?y WHERE { course:OSPF course:termName ?x. course:OSPF ?s ?t. ?s ?d ?z. ?t course:termName ?y. FILTER (regex(?z,"[^a-z]","i") && isLiteral(?z) ) }""" ,initNs=dict(course=Namespace..... @ msalvadores I want enter my Variable by console. --->python parse.py OSPF A value of variable(OSPF) may be another one. How can I initialize it

SPARQL recursive ancestor query

醉酒当歌 提交于 2019-12-07 09:18:27
问题 I'm stuck with a recursive query in SPARQL, I cant wrap my head around it. I want to get all ancestors of an instance " a " ( a hasParent b, b hasParent c, c hasParent d ) so the result would be " b, c ,and d " if instance is " a ". Any ideas how to construct the linked part where parent has a parent which has another parent? (The depth of the recursion is not known) 回答1: See SPARQL property paths and operator + . SELECT * { <a> <hasParent>+ ?ancestor } 来源: https://stackoverflow.com/questions

Fuseki GC overhead limit exceeded during data import

吃可爱长大的小学妹 提交于 2019-12-07 06:25:57
问题 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

Single quad + most basic SPARQL query = 1 result in Jena, 2 results in Sesame - who is right?

≡放荡痞女 提交于 2019-12-07 05:30:27
问题 Add just this one quad to an empty store: <http://x.com/s> <http://x.com/p> 2 <http://x.com/g> . Then execute this SPARQL query (taken from per Bob DuCharme's book 'Learning SPARQL', so this must be standard SPARQL for retrieving all quads across the dataset, regardless of implementation, right!?): SELECT ?g ?s ?p ?o WHERE { { ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } } } But Jena and Sesame reply with different answers!!? Here's what I see: Jena Fuseki console on Tomcat 6.0.37 (version 2.10.0

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

[亡魂溺海] 提交于 2019-12-07 05:23:21
问题 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? 回答1: First, prefer langMatches for checking language tags. This is especially important in your case, since you might want, for instance, a

Add text search where clause to SPARQL query

不羁岁月 提交于 2019-12-07 05:17:30
问题 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

Getting a list of American physicists from DBpedia using SPARQL

ぃ、小莉子 提交于 2019-12-07 03:50:35
问题 I want to query the American Physicsts and get the list of physicists. How can I do this? 回答1: 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