sparql

Why does my SPARQL query duplicate results?

吃可爱长大的小学妹 提交于 2019-12-07 02:28:27
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"). FILTER regex (?v,"Voiture"). } This gives me these results: Expected result is: While first reading your

How to get all of the subjects of a Jena Query?

本秂侑毒 提交于 2019-12-06 23:55:34
问题 Suppose I have some jena query object : String query = "SELECT * WHERE{ ?s <some_uri> ?o ...etc. }"; Query q = QueryFactory.create(query, Syntax.syntaxARQ); What would be the best way to get all of the subjects of the triples in the query? Preferably without having to do any string parsing/manipulation manually. For example, given a query SELECT * WHERE { ?s ?p ?o; ?p2 ?o2. ?s2 ?p3 ?o3. ?s3 ?p4 ?o4. <http://example.com> ?p5 ?o5. } I would hope to have returned some list which looks like [?s,

SPARQL query rdf container (rdf: Bag)

﹥>﹥吖頭↗ 提交于 2019-12-06 22:50:06
问题 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>

SPARQL DESCRIBE query

ぃ、小莉子 提交于 2019-12-06 18:24:52
问题 Seems I don't grok SPARQL DESCRIBE queries. I need to retrieve the full graphs of resources matching a condition. On one SPARQL endpoint I have tried (Norwegian Rådata Nå, http://data.bibsys.no/data/query_authority.html) this works just fine: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> DESCRIBE ?person WHERE { ?person rdf:type foaf:Person . FILTER EXISTS { ?person owl:sameAs ?sameAs } } LIMIT

How to display alert box when no json value is given

有些话、适合烂在心里 提交于 2019-12-06 16:32:13
问题 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",

How to turn a SPARQL/SPIN query/rule into an RDF structure from Java?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 16:15:09
问题 I have been using TopQuadrant Composer Free Edition (TBC FE) to embed SPARQL/SPIN rules (primarily SPIN constructors) in my OWL ontologies stored as RDF. Part of this process is that the SPARQL source code is tokenized/encoded in an RDF structure according to http://spinrdf.org/sp.html which the schema specified in http://spinrdf.org/sp. It is this structure that actually gets interpreted by RDF4J to run the SPIN rules. I'm also using RDF4J as my triple store, reasoner, SPARQL endpoint, and

What are values starting with “t” and how to ignore them for counting

喜你入骨 提交于 2019-12-06 15:09:39
I am trying to query the frequency of certain attributes in Wikidata , using SPARQL. For example, to find out what the frequency of different values for gender is, I have the following query: SELECT ?rid (COUNT(?rid) AS ?count) WHERE { ?qid wdt:P21 ?rid. BIND(wd:Q5 AS ?human) ?qid wdt:P31 ?human. } GROUP BY ?rid I get the following result: wd:Q6581097 2752163 wd:Q6581072 562339 wd:Q1052281 223 wd:Q1097630 68 wd:Q2449503 67 wd:Q48270 36 wd:Q44148 8 wd:Q43445 4 t152990852 1 t152990762 1 t152990752 1 t152990635 1 t152775383 1 t152775370 1 t152775368 1 ... I have the following questions regarding

How to list all all graphs in Virtuoso?

▼魔方 西西 提交于 2019-12-06 14:10:26
When I go to http://localhost:8890/sparql/ , there are two fields: Default Data Set Name (Graph IRI) and query . How can I list what all graphs (that go in the former field) are available in my DB? The field is not mandatory and I can just run a query against all namespaces. But I would like to know how to list the graphs available. The only non-empty graph I was able to run was http://localhost:8890/sparql For example, in a relational database environment, I believe this kind of info could be retrieved from system tables. As noted in comments, this query will get you a list of all Named

Error with SPARQL on Rstudio

谁都会走 提交于 2019-12-06 14:06:37
I'm using the sparql package in Rstudio, to query OMIM through bio2rdf. I have tested my query in yasgui and it works correctly. But from Rstudio he returns the following error: > qde <- SPARQL(endpoint,query) Opening and ending tag mismatch: hr line 5 and body Opening and ending tag mismatch: body line 3 and html Premature end of data in tag html line 1 Error: 1: Opening and ending tag mismatch: hr line 5 and body 2: Opening and ending tag mismatch: body line 3 and html 3: Premature end of data in tag html line 1 Thanks!! 来源: https://stackoverflow.com/questions/50346119/error-with-sparql-on

Using SPARQL to query DBPedia Company Information

假如想象 提交于 2019-12-06 11:49:01
I'm trying to query DBPedia using SPARQL only to find company information such as a description, and a logo. I'm rather lost with devising the SPARQL Query to do this. SELECT DISTINCT ?subject ?employees ?homepage WHERE { ?subject rdf:type <http://dbpedia.org/class/yago/Company108058098> . ?subject dbpedia2:numEmployees ?employees FILTER ( xsd:integer(?employees) >= 50000 ) . ?subject foaf:homepage ?homepage . } ORDER BY DESC(xsd:integer(?employees)) LIMIT 20 I have come across the above query, which finds companies with over 50,000 emplayoees, but I don't understand such things as the rdf