sparql

how to search for strings with different language code

帅比萌擦擦* 提交于 2019-12-11 05:09:31
问题 I need to search items in two graphs with the same string, but different language codes ("xx"@en and "xx"@eng - from wordnet). obviously "xx"@en is not equal to "xx"@eng. it can be done with (prefix nlp suitably defined): select * where { ?a nlp:lemma ?as . ?b rdfs:label ?bs . filter (str(?as)=str(?bs)) . # more code using ?a and ?b } However, this query takes too long and is wasteful. It should be possible to do something like: ?a nlp:lemma ?s . ?b rdfs:label ?s . but i cannot see how -

Querying letter mu in Sparql

左心房为你撑大大i 提交于 2019-12-11 05:04:10
问题 I am using python library RDFLIB to query on semantic dicom owl file. I need to query for a label containing letter mu. I am not able to figure out how to query for labels containing this letter. The code is given below - q = """SELECT ?ur WHERE{?ur rdfs:label "Exposure in uAs".}""" qres = g.query(q) for row in qres: print(row) I am not getting any results for the above query. The semantic dicom owl files contain the following triples - Image of what I am trying to search contents of sedi

Creating a pattern from a property path

☆樱花仙子☆ 提交于 2019-12-11 04:44:52
问题 Given an RDF::URI and a SPARQL property path (stored as a String), I want to find values that satisfy the following query SELECT ?value WHERE { <URI> <property_path> ?value . } I managed to get by using the following snippet, but is feels very hackish: query = SPARQL.parse(<<~QUERY) SELECT ?value WHERE { <#{uri}> #{property_path} ?value } QUERY graph.query(query) Is there a better way to achieve this, using a RDF::Query for example? 回答1: From my understanding, you consider string

SPARQL: extract distinct values from dbpedia

我是研究僧i 提交于 2019-12-11 04:44:45
问题 I want to extract graphs for 5 individuals who are Film(or movies) from DBPedia. My query is: ParameterizedSparqlString qs = new ParameterizedSparqlString( "" + "construct{?s ?p ?o}"+ "where{?s a http://dbpedia.org/ontology/Film ."+ "?s ?p ?o"} OFFSET 0 LIMIT 5" ); I get the following result: 1- http://dbpedia.org/resource/1001_Inventions_and_the_World_of_Ibn_Al-Haytham http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Film . 2- http://dbpedia.org/resource/1001

Apache Fuseki: invoke str function

老子叫甜甜 提交于 2019-12-11 04:39:38
问题 I would run this query: SELECT DISTINCT ?id str(?name) but Fuseki give me this error: This line is invalid.Expected ( VAR1... I would need a string value of ?name . 回答1: I suppose you are talking about something like this. This message is a warning produced by Fuseki component called YASGUI (or rather YASQE). You have two options: Use more conformant syntax, i. e. SELECT DISTINCT ?id (str(?name) AS ?str_name) etc. Ignore this warning and run your query, Jena ARQ should accept it and return a

How can I tell Stardog to use inference when querying it through SPARQLwrapper?

江枫思渺然 提交于 2019-12-11 04:31:35
问题 I have a SPARQL query that returns results in the Stardog query panel when inference is enabled, but not when it's disabled. When I try the query through python with SPARQLwrapper, I get no results. I tried with a different query, which doesn't rely on inference, and got the same results through the Stardog query panel without inference and through SPARQLwrapper. So I suspect reasoning is not being applied when I query through python, and that this is why there's no results. So my question is

How to retrieve the categorical details in wikidata

自古美人都是妖i 提交于 2019-12-11 04:24:22
问题 I have a list of instances as follows. myinstances = ['word2vec', 'tf-idf', 'dijkstra's algorithm'] For each myinstance in the above list, I want to find: 1. What are the other instances of `myinstance`'s category (i.e. only one hop) 2. What are the instances of `myinstance`'s category's category (i.e. two hops) For example, if we consider myinstance = word2vec What are the other instances of myinstance 's category (i.e. only one hop)? As shown in the figure below the other instances of its

Wikidata SPARQL query with label not working

只谈情不闲聊 提交于 2019-12-11 04:11:20
问题 I can't understand why with this query I can't get movement and genre labels: SELECT DISTINCT ?item ?itemLabel ?value ?inception ?creatorLabel ?image (group_concat(?genreLabel; separator=", ") AS ?genres) (group_concat(?movementLabel; separator=", ") AS ?movements) WHERE { ?item wdt:P4610 ?value; wdt:P18 ?image. #with an image OPTIONAL { ?item wdt:P571 ?inception; #optionally with creationdate wdt:P170 ?creator; #Optionally with creator wdt:P136 ?genre; wdt:P135 ?movement. } SERVICE wikibase

SPARQL query works in Fuseki but not in Jena TDB

本秂侑毒 提交于 2019-12-11 03:21:42
问题 I have my data organised in multiple graphs. The graph in which a triple is saved matters. The data structure is complicated but it can be simplified like this: My store contains cakes, where there's a hierarchy of different cake types, all subclasses of <cake> <http://example.com/a1> a <http://example.com/applecake> <http://example.com/a2> a <http://example.com/rainbowcake> ... Depending on how they get created by a user in a UI, they end up in a different graph. If for instance the user

Alternatives to the OPTIONAL fallback SPARQL pattern?

两盒软妹~` 提交于 2019-12-11 03:09:39
问题 I need to retrieve a single image for each resource in a target set, testing multiple non-exclusive predicates with a priority order. I'm currently using a standard OPTIONAL fallback pattern along the lines of select ?r ?i where { ?r a dbo:Automobile . optional { ?r <http://dbpedia.org/ontology/thumbnail> ?i } optional { ?r <http://xmlns.com/foaf/0.1/depiction> ?i } optional { ?r <http://xmlns.com/foaf/0.1/logo> ?i } optional { ?r <http://schema.org/image> ?i } } but this approach is turning