W3C home > Mailing lists > Public > public-sparql-dev@w3.org > October to December 2009

convert SQL to SPARQL

From: Ricardo Almeida <ric_gabriel@hotmail.com>
Date: Fri, 16 Oct 2009 14:53:28 +0100
Message-ID: <BAY120-W377BB52DB8313D4F3473D69EC40@phx.gbl>
To: <public-sparql-dev@w3.org>

I, 

i have a doubt in converting the followyng SQL,



SELECT p.nome, p.morada,
COUNT(r.matricula)

FROM Pessoa as p,
Registo as r 

WHERE p.nif = r.nif

GROUP BY p.nome

to SPARQL. 





PREFIX ex:<http://exemplo.com/ontologia Ex#>

SELECT ?nome ?morada COUNT(?matricula)

WHERE {?pId  rdf:type  <ex:Pessoa>

 ?rId rdf:type  <ex:Registo>

 ?pId <ex:nome> ?nome

 ?pId <ex:morada> ?morada

 ?rId <ex:temRegisto>
?registoId

 ?registoId <ex:matricula> ?matricula GROUP BY (?nome) }
Is  this correct, or the GROUP BY is an extension?
Thanks,
Ricardo.
 		 	   		  
_________________________________________________________________
Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
Received on Friday, 16 October 2009 17:21:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 16 October 2009 17:21:12 GMT