rdf

While using Jena (java) or RDFLib (python), how should I find out whether to open the ontology as 'turtle' or 'xml'?

拥有回忆 提交于 2019-12-24 06:58:15
问题 Ontology files usually have extensions such as .owl or .rdf. I want to know when I should open ontologies with 'turtle' and when with 'xml' or other formats? Because it seems that each of them is useful for a type of format and unfortunately, it seems that people sometimes save files with the wrong extension. Here is a sample code in Python (but java is not very different either): g.parse('ontology.owl', format='turtle') So, how do I know here the turtle is the correct format? Thanks in

Comparing two strings with SPARQL

空扰寡人 提交于 2019-12-24 06:43:57
问题 i'm using the regex function with SPARQL. Is there a function which find a string that have minimum distance from another one? I mean, i need a function which gives me the most similar word compared with another one. Actually i pass two variables (these variables take values form two different datasets) and compare just considering these case insensitive. So i need a function that can compare two variables. Does anybosy know anything ? 回答1: There is no such function in standard SPARQL.

How rdf:Bag, rdf:Seq and rdf:Alt is different while using them?

折月煮酒 提交于 2019-12-24 05:26:05
问题 I'm reading the RDF Schema 1.1 recommendation, which includes the following (emphasis added): 5.1.2 rdf:Bag The rdf:Bag class is the class of RDF 'Bag' containers. It is a subclass of rdfs:Container. Whilst formally it is no different from an rdf:Seq or an rdf:Alt, the rdf:Bag class is used conventionally to indicate to a human reader that the container is intended to be unordered. 5.1.3 rdf:Seq The rdf:Seq class is the class of RDF 'Sequence' containers. It is a subclass of rdfs:Container.

Extend DBpedia entity in Protege ontology

删除回忆录丶 提交于 2019-12-24 04:00:16
问题 I'm using Protege to develop an ontology that will include some things that are already described in DBpedia. Let's say I want to include a class 'Cities' and have 'Berlin' as an individual. My Berlin will have some properties the DBpedia Berlin doesn't but otherwise I'd like to 'reuse' DBpedia's Berlin. Do I need to define my own Berlin and then use rdf:seeAlso or can I somehow import DBpedia's Berlin and add some properties? 回答1: Just use the DBpedia IRI, If it's sufficient to simply talk

Parse RDF XML file to get all rdf:about values

*爱你&永不变心* 提交于 2019-12-24 03:17:31
问题 I am using php's simple xml and xpath to parse an rdf xml file and am struggling to get a list of all the rdf:about values. Any advice? 回答1: There seems to be an issue when using SimpleXml with namespaced attributes prior to PHP5.3. Basically, anything with a : will be dropped when converted to an object property of a SimpleXml element. The following will do, but feels hackish to me: $rdf = str_replace('rdf:about', 'rdf_about', $rdf); $rdf = new SimpleXMLElement($rdf); foreach($rdf->xpath('//

How to limit the Scope of element extraction between the start and end tag of a particular xml element using XPath in Python?

烈酒焚心 提交于 2019-12-24 02:42:47
问题 I have an RDF/XML Element and would like to find out all the elements between the start and end of a particular tag. How could I do that? for example : <cim:BaseVoltage rdf:ID="_0526B48408F744919E7C03672FCD0D71"> <cim:BaseVoltage.isDC>false</cim:BaseVoltage.isDC> <cim:BaseVoltage.nominalVoltage>400.000000000</cim:BaseVoltage.nominalVoltage> </cim:BaseVoltage> I would like to extract the values BaseVoltage.isDC and BaseVoltage.nominalVoltage, since they are between the start and end tag of .

How to return a single foaf:name?

人盡茶涼 提交于 2019-12-24 02:32:03
问题 I have the following DBpedia SPARQL that shows philosophers that influenced philosophers. However, it returns duplicates when the philosopher has more than one foaf:name : SELECT ?name ?influencedName WHERE { ?philosopher a dbpedia-owl:Philosopher ; dbpedia-owl:influenced ?influenced ; foaf:name ?name . ?influenced a dbpedia-owl:Philosopher ; foaf:name ?influencedName . } SPARQL results How can I return a single name if there are multiple values for ?name and ?includedName . I would be happy

Using a year's natural number value in a SPARQL query

梦想与她 提交于 2019-12-24 00:57:45
问题 How do I query wikidata for a list of scientists that died in a prime-numbered year, and also were born in a prime-numbered year, using SPARQL? Here is what I have so far, which returns no results, and I'm assuming that's because people don't die in a number, but rather in a year... Also missing is the UNION statement for those born in a prime-numbered year, but we can omit that for the sake of focus. SELECT ?number ?scientist ?scientistLabel WHERE { ?number wdt:P31 wd:Q49008. ?scientist wdt

how to create aggregation on a graph from CONSTRUCT

倖福魔咒の 提交于 2019-12-24 00:54:49
问题 This is my query: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rs: <http://www.welovethesemanticweb.com/rs#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> construct { ?subject0 rs:similarityValue ?similairty0. ?subject1 rs:similarityValue ?similairty1 } WHERE { { ?subject0 ?predicate0 ?object0. rs:Impromptu_No._1 ?predicate0 ?object0. ?predicate0 rs:hasSimilarityValue ?similairty0Helper. BIND(?similairty0Helper * (4/9) AS ?similairty0) FILTER (?subject0 != rs

Filtering SPARQL results by day and month

只谈情不闲聊 提交于 2019-12-24 00:29:47
问题 I'm currently using the http://dbpedia.org/snorql website to launch some basic request like the one below: PREFIX dbpedia0: <http://dbpedia.org/ontology/> SELECT ?body ?value WHERE { ?body a dbpedia0:Person. ?body dbpedia0:birthDate ?value. } ORDER BY ?value I would like to find a way of filtering the results so that only people born on day X month Y are being selected (no matter the birth year). I have been trying to do so with many approaches like: 1) Basic filtering: FILTER(xsd:date(?value