SPARQL query for RDF file

I have an RDF file similar to the one shown below. But it's hard for me to make requests. For example, can someone tell me a simple request where I could get information about (http://websitename.com/urls/a) or a resource (http://websitename.com/urls/b) or about a resource where the / owl relationship is the same.

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:owl="http://www.w3.org/2002/07/owl#" > <rdf:Description rdf:about="http://websitename.com/urls/a"> <owl:sameas rdf:resource="http://websitename.com/urls/b"/> </rdf:Description> </rdf:RDF> 

thanks

+4
source share
1 answer

You have been bitten by a common misconception among novice RDF / XML users that attribute names are directly related to actual data, when in reality this is not so. Attribute names in rdf namespaces are simply XML syntax and are not actually associated with URIs in data, on the other hand, in other namespaces, for example. The owl in your examples is usually directly related to the URI in the data. This is why it is so easy for people new to RDF / XML to get confused.

If we convert your data into a more readable syntax, such as Turtle, it looks like this:

 @prefix : <http://websitename.com/urls/> . @prefix owl: <http://www.w3.org/2002/07/owl#sameas> :a owl:sameAs :b . 

In most cases, people prefer to display RDF fragments as turtles, as they are more readable and easily see what the data represents.

Thus, for the actual request, you may need the following request:

 PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT ?x ?y WHERE { ?x owl:sameAs ?y } 
+6
source

Source: https://habr.com/ru/post/1386840/


All Articles