On virtuoso you need to use concat to count tuples of variables:
select count(concat(?s,"|", ?o)) as ?indegree where {
?s ?o <http://dbpedia.org/resource/Cat>.
}
will return 81 on http://dbpedia.org/sparql
On Thu, Sep 19, 2013 at 11:51 AM, Julien Plu <
julien....@redaction-developpez.com> wrote:
> Hi,
>
> I have a problem with a SPARQL, I try to find a valid query for SPARQL
> 1.0 through Virtuoso 06.01.3127 for doing a query like this :
>
> INSERT { GRAPH <http://my/graph> { ?s <http://my/ontology/indegree>
> count(?x) }} where {
> GRAPH <http://my/graph> {
> ?x ?p ?s .
> ?s a <http://my/ontology/Person>
> }
> }
>
> Most precisely I try to add a triple which represents the number of
> triples which have for object a same subject for each person. For example
> for this graph :
>
> <http://Person/1> <http://my/ontology/knows> <http://Person/2> .
> <http://Person/3> <http://my/ontology/isBossOf> <http://Person/2> .
> <http://Person/4> <http://my/ontology/isFatherOf> <http://Person/2> .
>
> The result must be the triple : <http://Person/2> <
> http://my/ontology/indegree> "3" .
>
> Anyone knows how to do this easily just with a query ?
>
> Thanks in advance.
>
> Julien.
>
--
Jim McCusker
Data Scientist
5AM Solutions
jmccus...@5amsolutions.com
http://5amsolutions.com
PhD Student
Tetherless World Constellation
Rensselaer Polytechnic Institute
mcc...@cs.rpi.edu
http://tw.rpi.edu
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users