Hi Aldo,
Here are some links of calling (bif) functions in SPARQL queries:
1.
http://virtuoso.openlinksw.com/presentations/SPARQL_Tutorials/SPARQL_Tutorials_Part_2/SPARQL_Tutorials_Part_2.html
2. http://docs.openlinksw.com/virtuoso/rdfsparql.html#rdfsqlfromsparql
Best Regards,
Rumi
Thanks Ivan,
2010/11/19 Ivan Mikhailov <[email protected]>:
Hello Aldo,
I'd suggest to use SQL BIFs sequence_next() and sequence_set(). Like any
other functions without INOUT or OUT parameters, they can be called from
SPARQL as bif:sequence_next() / bif:sequence_set()
http://docs.openlinksw.com/virtuoso/fn_sequence_next.html
http://docs.openlinksw.com/virtuoso/sequenceobjects.html
For user-defined functions, an sql: prefix is better than bif: .
sql:foo(x) will call DB.DBA.foo(x) . The difference is that bif:foo will
create the call of unqualified foo(). If no built-in function foo()
exists and the system contains many users and database qualifiers, the
search for exact name of XXX.YYY.foo() may consume nonzero time (taking
all security bore-me into account).
It works perfectly and thanks for the clarification between bif: and sql:
Now, from my own set of observations, I have learnt to call procedures
in SPARQL this way:
select (bif:sequence_next(?s)) as ?id where { ?s ?p ?o } limit 1
Does that seem right?
Regards,
A
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com
On Fri, 2010-11-19 at 19:17 -0300, Aldo Bucchi wrote:
Hi,
Problem
* I need to generate unique IDs from within Virtuoso ( unique only to
a given Virtuoso instance/cluster would suffice )
* I need to do this via SPARQL HTTP prior to issuing a SPARQL insert
Current solution:
Create a table and procedure that keeps track of an incremental ID and
returns each ID only once.
Access this procedure via SPARQL HTTP by using the ( select (
bif:foo() ) as ?id where { ?s ?p ?o } limit 1 ) trick.
Question:
Any suggestions?
- for a better way of generating uniques
- for a better way of accessing the procedure from SPARQL
?
Also. I understand that blank nodes provide similar functionality. But
how can I access the "last insert id"?
Regards,
A
--
Aldo Bucchi
@aldonline
skype:aldo.bucchi
http://aldobucchi.com/
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users