Hi Ivan,

Thank you for information: it is really what I need. I have replaced my
entities' GUIDs with sequence generated integers.

The one question about sequences arised during documentation reading.
Sequence_next
bif documentation<http://docs.openlinksw.com/virtuoso/fn_sequence_next.html>says
it returns integer (32 bits) and cluster edition documentation
says 
<http://docs.openlinksw.com/virtuoso/clusterprogrammingseqidenreg.html>sequence
returns 64-bit integer. Is it cluster edition specific? I remember
I read about some Virtuoso mechanism that upgrades 32-bit values to 64-bit
values (can't find it now). Does it work for sequences?

Regards,
Alexander

2010/2/26 Ivan Mikhailov <[email protected]>

> Hello Alexander,
>
> You may use sequence_next()
> (http://docs.openlinksw.com/virtuoso/fn_sequence_next.html) BIF as
> source of autoincremented integers.
>
> However this function should be used with care in SPARUL statements as
> well as in UPDATE SQL statement. The optimizer does not know that the
> function returns new value every time so it may decide to call it once
> at the beginning of the query run and reuse the result. That may not
> match your intention if you manipulate a batch of different rows in a
> single request. To fool the optimizer, pass fake third argument to the
> function such as a primary key of the updated row or fields of inserted
> rows or the like, i.e. something that obviously can not be calculated in
> advance. The function will ignore them but the optimizer will be fooled
> in a desired way.
>
> To construct sequential IRIs, the popular trick is
> IRI(bif:sprintf('...%d...', bif:sequence_next ('mysequence',
> 1, ?some_variable_from_select)))
> Wrap an expression like this in backquotes and use in constructor
> template instead of a plain variable, that's all.
>
> Note that bif:sprintf should form an absolute IRI as namespace prefixes
> and BASE will not play any role at the runtime.
>
> Best Regards,
>
> Ivan Mikhailov
> OpenLink Software
> http://virtuoso.openlinksw.com
>
> On Fri, 2010-02-26 at 11:54 +0100, Alexander Sidorov wrote:
> > Hello!
> >
> > What is the preferred way of stroring autoincrement values in
> > RDF-storage? Now I just use GUIDs (but don't like them) and have some
> > workaround ideas of using relational table's autoincrement field
> > values at RDF-storage. But may be there is some build-in support?
> >
> > Regards,
> > Alexander
>
>
>

Reply via email to