tags:

views:

23

answers:

2

i want to record anonymous users 'liking' records:

user:1 vocab:likes record:123234 .
user:2 vocab:likes record:124534 .

is there a way to add incremental values in rdf/turtle without explicitly stating them?

thanks :)

+2  A: 

I'm not sure I understood correctly what you're after. Assuming you want some kind of anonymous resource for the subject user:n part, you can use blank nodes, like:

[] vocab:likes record:r123234 .
[] vocab:likes record:r123234, record:r124534 . # this anon. user likes two records
laalto
@iaalto if you create blank nodes you won't be able to reference once they've been created. You can't link to/from a blank node once it's been created since you don't know what id they're given. It is possible solution but one should bear in mind this issue.
msalvadores
@msalvadores: Yeah, sure. And if you want to reference a given blank node in Turtle, you can explicitly refer to it like `_:user1` and not have the Turtle parser generate the blank ID for you. Though, RDF processors are free to remap blank IDs as they see fit. A blank ID is guaranteed to refer to the same anonymous resource only within the scope of the document being processed.
laalto
+3  A: 

I don't think there is nothing in the RDF Data Model that allows you to create sequential URIs. Maybe you could have a look to the RDF next steps to see if there is something coming. The closest thing might RDF Lists which I strongly not recommend, they are difficult to handle at the application level.

I would not use bNodes either because they will limit the ability of your app in many ways. You won't be able to do further linking of the object once you've created it. I always avoid creating bNodes whenever is possible.

Most of the times there is hash function that you could use to create URIs. For instance if your app handles unique user ids then you could do:

user:msalvadores vocab:likes record:hashRecordId1 .
user:significance vocab:likes record:hasRecordId2 .

For the records if you have unique piece of information use it to generate the URI or in the worst case scenario use a timestamp based URI.

It is not the smartest solution but it works.

msalvadores
thanks. so if i want to add a sequentially numbered record i guess i have to do a count query first.thanks
significance