Marc-Alexandre Nolin wrote:
Hello,

When I do the following query:

select distinct
?s
where
{
?s rdf:type <http://biology.com/Protein> .
}
limit 100

Lets say I have 20000 objects of type protein in the triplestore. I
will receive a results containing 100 rows of 100 distinct proteins.
If I run the same query again, I will receive the same 100 distinct
proteins.

Is there a way to receive a RANDOM set 100 proteins everytime I run
the query? I bet its not possible in Sparql itself, but could it be
with the Virtuoso toolset of bif:_something_ ? If its not there, how
can I expand the bif toolset ?

For example, it could be a query like this:

select distinct
?s
where
{
?s rdf:type <http://biology.com/Protein> .
bif:random(?s, 100) .
}

USE : bif:random(<variable you want a random set>, <the amount you want>)

Implemented that way, I could expand the query with other attribute.

select distinct
?s
where
{
?s rdf:type <http://biology.com/Protein> .
bif:random(?s, 100) .
?s <http://biology.com/chromosomeNumber> ?cn .
filter(?cn == 10) .
}

Thanks,

Marc-Alexandre Nolin

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Marc,

You've answered the question :-)

Just make a Stored Procedure and surface it as a magic/function predicate.

Links:

1. http://docs.openlinksw.com/virtuoso/rdfsparql.html#rdfsqlfromsparql

--


Regards,

Kingsley Idehen       Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO OpenLink Software Web: http://www.openlinksw.com





Reply via email to