1

This is my RDF graph represented in RDF/XML fromat:

<?xml version="1.0" ?>
<rdf:RDF 
   xmlns:ex="http://www.example#" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xml:base="http://www.test#">
   
   <ex:cat rdf:ID="_101">
      <ex:name>Milk</ex:name>
   </ex:cat>
   <ex:dog rdf:ID="_2001">
      <ex:name>Lub</ex:name>
   </ex:dog>
</rdf:RDF>

These are the triples I get when I parse it with w3.org/RDF/Validator:

Number   Subject                Predicate   Object
1        http://www.test#_101   rdf:type    ex:cat
2        http://www.test#_101   ex:name     "Milk"
3        http://www.test#_2001  rdf:type    ex:dog
4        http://www.test#_2001  ex:name     "Lub"

My question is why are there triples with rdf:type predicate? Which parts of my RDF/XML get mapped to those triples?

RedCrusaderJr
  • 350
  • 1
  • 12
user20297975
  • 129
  • 8
  • 2
    What do you mean by: "Why does Predicate become a http://www.w3.org/1999/02/22-rdf-syntax-ns#type"? What predicate are you talking about? This question is completely unclear. – RedCrusaderJr Nov 24 '22 at 02:20
  • 1
    I used this : https://www.w3.org/RDF/Validator/ If you input the code and parse RDF, s : http://www.test#_101 p : http://www.w3.org/1999/02/22-rdf-syntax-ns#type o : http://www.example#cat My question is why is Predicate being like that? – user20297975 Nov 26 '22 at 02:27
  • 1
    I heavily edited your original question, so please verify that this is indeed the question you meant to ask. If that is the case, information I added is very important so don't leave it out the next time. – RedCrusaderJr Nov 26 '22 at 12:38
  • Also, not to bring any confusion in, URIs `rdf:type` and `w3.org/1999/02/22-rdf-syntax-ns#type` are completely equivalent, and so are `ex:name` and `http://www.example#name`. You defined those prefixes with `xmlns:ex="http://www.example#"` and `xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"`. – RedCrusaderJr Nov 26 '22 at 12:40
  • One last thing, `rdf:ID="_101"` becomes `http://www.test#_101`, because `http://www.test#` is declared as base uri with `xml:base="http://www.test#"`. When no other prefix is given for some URIs, they get prefixed by the base URI. – RedCrusaderJr Nov 26 '22 at 13:08

1 Answers1

1

Let's analyse the following RDF/XML syntax:

<ex:cat rdf:ID="_101">
   <ex:name>Milk</ex:name>
</ex:cat>

In says that entity with id http://www.test#_101 of type ex:cat exists and that it has a property ex:name, with value "Milk". Thats why you get triples

http://www.test#_101   rdf:type    ex:cat
http://www.test#_101   ex:name     "Milk"

Whenever you have statement about an entity in RDF/XML it would start with

<TYPE_URI rdf:ID=ENTITY_ID>

which translates to a triple

TYPE  rdf:type  ENTITY_ID

proceeding with statements about property-value pairs for that entity. At the end you get the standard XML closing tag </TYPE_URI>.

RedCrusaderJr
  • 350
  • 1
  • 12
  • Thank you. I didn't know that mean TYPE rdf:type ENTITY_ID. But a new question arose. What is mean that ? Didn't the example end with ? Does that mean your words should be ? – user20297975 Nov 27 '22 at 08:00
  • That was a mistake, I fixed it – RedCrusaderJr Nov 27 '22 at 11:15
  • 1
    By accepting the answer that helped you, we keep the knowledge archive accessable to others. Also, Semantic web/RDF/SPARQL has a small community, so let it be appreciated – RedCrusaderJr Nov 27 '22 at 11:36
  • Why does it become rdf:type if rdf:ID changes to triple? Do you have any relevant information or standards? – user20297975 Nov 29 '22 at 02:25
  • @user20297975 I have a trouble understanding this part 'if `rdf:ID` changes to triple', so can you rephrase it somehow? If you are simply asking how I know that, well that's a completely valid question on which I don't have a precise answer other then try it with a couple of examples here w3.org/RDF/Validator, and see some examples here https://www.w3.org/TR/rdf-syntax-grammar/ – RedCrusaderJr Nov 29 '22 at 02:47
  • "The rdf:ID attribute on a node element (not property element, that has another meaning) can be used instead of rdf:about and gives a relative IRI equivalent to # concatenated with the rdf:ID attribute value. So for example if rdf:ID="name", that would be equivalent to rdf:about="#name". rdf:ID provides an additional check since the same name can only appear once in the scope of an xml:base value (or document, if none is given), so is useful for defining a set of distinct, related terms relative to the same IRI." This will clarify if `rdf:ID` predicate is the thing which added to confusion. – RedCrusaderJr Nov 29 '22 at 02:50
  • 1
    If you change to triple, it becomes http://www.test.com#_101 rdf:type ex:cat I understand, but why did the rdf:type suddenly appear? Is there anything I missed? – user20297975 Nov 29 '22 at 03:50
  • Okay now I think I understand your question. Here look at this: "3.3 rdf:type rdf:type is an instance of rdf:Property that is used to state that a resource is an instance of a class." https://www.w3.org/TR/rdf-schema/#ch_type – RedCrusaderJr Nov 29 '22 at 03:56
  • `rdf:type` is a predefined predicate which carries the semantics that a concrete instance is 'type of' some class. You define instances (URIs that identify them) with rdf:ID/rdf:about. I don't know how to define an instance with ni type in RDF/XML syntax. In previous examples, the first time we used `` we defined `ex:cat` as an URI of a class. When we used `` we defined instance `http://www.test#_101` as a type of class `ex:cat`, with properties.... and so on. Am I answering your question or we are still misunderstanding each other? – RedCrusaderJr Nov 29 '22 at 04:06
  • I think I'm getting very close to the answer. Finally, what is ni type? – user20297975 Nov 29 '22 at 05:09
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/249984/discussion-between-redcrusaderjr-and-user20297975). – RedCrusaderJr Nov 29 '22 at 08:33
  • To wrap it up, I hope I answered all your questions regarding this topic. Here is the book I cannot recommend enough `Foundations of Semantic Web Technologies`, by Markus Krötzsch, Pascal Hitzler, and Sebastian Rudolph. It has everything you need for a great and fresh start in the world of semantic web technologies. Also, heavily consult WC3 recommendations which define each concept of semantic web. Keep posting interesting questions and happy researching! – RedCrusaderJr Nov 30 '22 at 00:10