Reputation: 83
How do you specify a pair (or more) of attributes for an entity in RDF without losing the connection? (Sorry, I am a newbie.)
For example, I would like to say a GPS has a reading of latitude and longitude, but I want to specify something like 'GPS has (latitude, longitude)' rather than 'GPS has latitude' and 'GPS has longitude', because it becomes problematic when I have multiple readings and need to know which latitude goes with which longitude.
I've looked at RDF examples, but it wasn't very obvious to me how this could be done.
Thank you for any pointers.
[Edit] Upon further researching, i ran across bnode or anonymous node. Would this preserve the paring?
Upvotes: 1
Views: 92
Reputation: 16525
Essentially, you cannot do such thing unless you use RDF lists which I strongly not recommend for usability reasons. The good news is that with Blank nodes you can get very close to what you need. An example:
:gps :hasReading [
:longitud "x";
:latitude "y";
] .
Fundamentally this example does not create pairs but creates a blank node with two out-coming arcs :longitud
and :latitude
. I guess that what you need is to record multiple readings, this can be perfectly achieved with this model:
:gps :hasReading [
:longitud "x1";
:latitude "y1";
];
:hasReading [
:longitud "x2";
:latitude "y2";
].
Moreover, if you need to record extra properties for the reading you can add as many properties as you want.
Also, consider looking into Semantic W3C Geo Effort, in there you will find standard representations like the following:
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
_:bnode a geo:Point;
geo:lat "55.701";
geo:long "12.552".
Upvotes: 4
Reputation: 21984
What exactly stops you from creating two triples with the same predicate. I do not understand the reason to provide an abstract layer. But if you need to provide a container, that houses both the variables, then I would use a bag, if order does not matter or seq if order does matter. Examples here.
Upvotes: 1