sparql

SPARQL Querying Transitive

最后都变了- 提交于 2019-12-12 07:26:41
问题 I am a beginner to SPARQL and was wondering if there was a query which could help me return transitive relations. For example the n3 file below I would want a query that would return "a is the sameas c" or something along those lines. Thanks @prefix : <http://websitename.com/links/> . @prefix owl: <http://www.w3.org/2002/07/owl#> . :a owl:sameas :b. :b owl:sameas :c. 回答1: You can use property paths if you are using a suitably enabled SPARQL 1.1 engine, you've tagged your question Jena so I

Binding a variable to one of two values with IF?

Deadly 提交于 2019-12-12 07:17:43
问题 In the following SPARQL query, I'm not sure how to use if to bind one of two strings to the variable ?result . I heard that there are concepts of “in scope” and “out of scope,” but I don't really see the difference. I've also tried putting the if clause in the select line, but it didn't work either. How can I fix this query to bind ?result to one of the two strings based on the condition? SELECT ?result WHERE{ ?chain rdf:type rdfs:Property . ?chain rdfs:domain <http://www.vs.cs.hs-rm.de

Same sparql not returning same results

纵饮孤独 提交于 2019-12-12 06:56:05
问题 I'm using the same sparql statement using two different clients but both are not returning the same results. The owl file is in rdf syntax and can be accessed here. This is the sparql statement: PREFIX wo:<http://purl.org/ontology/wo/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> select ?individual where { ?individual rdf:type wo:Class } I'm using it using top braid and the following python program: >>> import rdflib >>> import rdfextras >>> rdfextras.registerplugins() >>> g

SPARQL query of Person using EasyRdf on DBpedia

白昼怎懂夜的黑 提交于 2019-12-12 06:14:28
问题 I want to get all information about a Person from the DBpedia SPARQL API. First problem is, the request took too long time. Second, I don't get back any information about the person I looked for. I don't know what I am doing wrong? My Code: require_once "EasyRdf.php"; require_once "html_tag_helpers.php"; // Setup some additional prefixes for DBpedia EasyRdf_Namespace::set('category', 'http://dbpedia.org/resource/Category:'); EasyRdf_Namespace::set('dbpedia', 'http://dbpedia.org/resource/');

How to create a custom AnalyzerFactory in GraphDB full text search?

北战南征 提交于 2019-12-12 04:45:23
问题 (Using GraphDB 8.1 free). http://graphdb.ontotext.com/documentation/free/full-text-search.html says that I can enable a custom AnalyzerFactory for GraphDB full-text search, using the luc:analyzer param, by implemeting the interface com.ontotext.trree.plugin.lucene.AnalyzerFactory . However I can't find this interface anywhere. It is not in the jar graphdb-free-runtime-8.1.0.jar. I checked the feature matrix at http://ontotext.com/products/graphdb/editions/#feature-comparison-table and it

Sparql - How to constuct RDF by selecting MAX values of objects grouped by properties?

家住魔仙堡 提交于 2019-12-12 03:42:54
问题 sorry for the irrevelant title, I'm French and I didn't know how to expose my problem. I think the best way to explain it is with an example. I have some RDF sets like this one: prefix p: <http://localhost/rdf/> p:set p:hasTitle p:val1 . p:set p:hasTitle p:val2 . p:set p:hasAuthor p:val3 . p:set p:hasAuthor p:val4 . p:val1 p:hasValue "Harry Peter" . p:val1 p:hasScore 0.30 . p:val2 p:hasValue "Harry Potter" . p:val2 p:hasScore 0.90 . p:val3 p:hasValue "J. K. Rowling". p:val3 p:hasScore 0.90 .

SPARQL query using rdf:ID returns no results

吃可爱长大的小学妹 提交于 2019-12-12 02:37:39
问题 I have an owl file and I am trying to run queries on it but not getting any results please some one help me to figure it out and explain basic querying public static void main(String[] args) { String filename="H:/Samson_study/nodeTest/hRESTS-TC3/ontology/ApothecaryOntology.owl"; Model model=ModelFactory.createDefaultModel(); OntModel model1=ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM,model); try { File file=new File(filename); FileInputStream reader=new FileInputStream(file);

How to query for all direct subclasses in SPARQL?

我怕爱的太早我们不能终老 提交于 2019-12-12 02:27:34
问题 I have A , B and C as classes related by the transitive property isSubClassOf . So A isSuclassOF B and B isSubClassOf C . So by inference we have A isSubClassOf C . My question: How can I write a SPARQL query to just return back for each Class its direct only subclass number. for example A 0 B 1 C 1 回答1: Within the standard SPARQL language, you can do this by querying for those subclasses where no other subclass exists "in between", like so: SELECT ?directSub ?super WHERE { ?directSub rdfs

DELETE QUERY SPARQL FUSEKI

假装没事ソ 提交于 2019-12-12 02:15:45
问题 How can I delete all triples statement for a given uri? My graph contains: PREFIX mo: <http://www.dbwic.org/ontology#> PREFIX term: <http://www.dbwic.org/ontology/terms/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> <http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a> term:title "tiitle album"; term:date "date title"; term:name " name ". I tried to delete all triples for http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a but the query is not working. PREFIX mo:

Why dbpedia result is not consistant

淺唱寂寞╮ 提交于 2019-12-12 02:08:48
问题 I'm executing the below SPARQL query PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?resource WHERE { ?resource a <http://dbpedia.org/ontology/Place> . {?resource rdfs:label 'Paris'@en.} UNION { ?resource rdfs:label 'France'@en.} } I'm executing this here. Sometimes I am getting required result and sometimes it returns 502 error ( I get the message that website is under maintenance.....) Can you please let me know why result is not consistent and how can I avoid this? Also