Newbie question: how to express a relationship with rdf?

I know this sounds extremely unlikely, but even after going through some textbooks at W3 schools on RDF and reading a primer, I cannot understand how the rdf relation of a simple object-predicate-object is expressed in XML format.

Say I have a concept like this:

I have a car. My car has a GPS receiver. The gps coefficients of the current car are the latitude X, Y longitude.

I imagine it as

<RDF>
 <Owner Name="me">
  <has>car</has>
 <car>
  <has>gpsreceiver</has>
  <has><cordinates X="somevalue", Y="somevalue"></has>
 </car>
 </Owner>
</RDF>

How is it written? I find it difficult to understand how objects, objects, and predicates are mapped to elements and attributes.

, , "" , , " ABC DEF, 12,34 ".

, ? , , , rdf , : - (

+5
3

, XML, . , , .

, , , . , . , - RDF - . , GPS , GPS , . , :

:car127 rdf:type :Car .
:gps99 rdf:type :GPS.

, , , ( car127) ( rdf:type) ( Car) GPS.

, . , , - , , ( , ):

:nina rdf:type foaf:Person.
:nina foaf:name "Nina".
:car127 :ownedBy :nina.

(, , URI :nina Nina).

GPS :

:car127 :containsComponent :gps99.

, GPS "" . , ( , :). , x y, GPS, . , GPS , . :

:gps99 :reading [
    rdf:type :Reading;
    :lat 51.14276;
    :long -2.71619;
    :at "2011-09-02T123400"^^xsd:dateTime
].

[...] - , - , . node bNode, , . , GPS :Reading (': ') ( R - , , ). : , , . , , , ... !

+5

, , XML , , .

, :

:Me :owns :MyCar .
:MyCar :hasPart :GpsReceiver .
:MyCar :hasXPosition "x" .
:MyCar :hasYPosition "y" .

, , , .

RDF , , , / , RDF/XML .

+2

I would write (ignoring decl namespaces)

<rdf:RDF >
 <!-- about 'me' -->
 <my:Owner rd:about="http://example.com/me">
  <my:has rdf:resource="http://example.com/thecar"/>
 </my:Owner>

 <!-- about the car -->
 <my:Car rdf:about="http://example.com/thecar">
  <my:hasPosition>
     <my:Gpsreceiver>
         <my:X>somevalue</my:X>
         <my:Y>somevalue</my:Y>
      </my:Gpsreceiver>
   </my:hasPosition>
 </my:Car>
</rdf:RDF>

You can confirm your rdf at: http://www.w3.org/RDF/Validator/

0
source

All Articles