Re: Trying to count the properties used for each class

2022-01-26 Thread Bob DuCharme

Thank you Martyna and Nicola. Both queries worked perfectly!

Bob


On 1/24/22 6:21 PM, Nicola Vitucci wrote:

Hey Bob,

does this one do what you're after?

SELECT DISTINCT ?cl (COUNT(DISTINCT ?p) AS ?c)
WHERE {
   ?s a ?cl .
   ?s ?p ?o .
}
GROUP BY ?cl

Nicola

Il giorno lun 24 gen 2022 alle ore 23:05 Bob DuCharme  ha
scritto:


Using arq and the data at
http://www.snee.com/bobdc.blog/files/BeatlesMusicians.ttl, I’m trying to
write a query that will list the classes used in the data and the number
of distinct properties used by instances of that class. I’m having a
hard time and can’t even write a query that lists the number of
properties used for just one of the classes; the following just shows me
a series of ones.

 SELECT (COUNT(DISTINCT ?p) AS ?pcount)
 WHERE {
?s a  .
?s ?p ?o .
 }
 GROUP BY ?p

Any suggestions?

Thanks,

Bob




Re: Trying to count the properties used for each class

2022-01-26 Thread Nicola Vitucci
Thanks Alasdair,

This looks really useful. I haven't seen this query though - have I missed
it or were you not specifically referring to this?

Nicola


Il mar 25 gen 2022, 10:21 Gray, Alasdair  ha
scritto:

> We defined a lot of useful statistics queries for datasets in §6.6 of the
> W3C HCLS Dataset Description Guidelines
> https://www.w3.org/TR/hcls-dataset/#s6_6
>
> I’ve made these available in a GitHub repo
> https://github.com/AlasdairGray/HCLS-Stats-Queries
>
> Hopefully you find these helpful
>
> Alasdair
> --
> Alasdair J G Gray
> Associate Professor in Computer Science,
> School of Mathematical and Computer Sciences
> Heriot-Watt University, Edinburgh, UK.
>
> Email: a.j.g.g...@hw.ac.uk
> Web: http://www.macs.hw.ac.uk/~ajg33
> ORCID: http://orcid.org/-0002-5711-4872
> Office: Earl Mountbatten Building 1.39
> Twitter: @gray_alasdair
>
>
> Heriot-Watt is a global University, as a result my working hours may not
> be your working hours. Do not feel pressure to reply to this email outside
> your working hours.
>
>
> To arrange a meeting:
> https://outlook.office365.com/owa/calendar/alasdairg...@heriotwatt.onmicrosoft.com/bookings/
>
> From: Nicola Vitucci 
> Date: Monday, 24 January 2022 at 23:21
> To: users@jena.apache.org 
> Subject: Re: Trying to count the properties used for each class
> 
> Caution: This email originated from a sender outside Heriot-Watt
> University.
> Do not follow links or open attachments if you doubt the authenticity of
> the sender or the content.
> 
>
>
> Hey Bob,
>
> does this one do what you're after?
>
> SELECT DISTINCT ?cl (COUNT(DISTINCT ?p) AS ?c)
> WHERE {
>   ?s a ?cl .
>   ?s ?p ?o .
> }
> GROUP BY ?cl
>
> Nicola
>
> Il giorno lun 24 gen 2022 alle ore 23:05 Bob DuCharme  ha
> scritto:
>
> > Using arq and the data at
> > http://www.snee.com/bobdc.blog/files/BeatlesMusicians.ttl, I’m trying to
> > write a query that will list the classes used in the data and the number
> > of distinct properties used by instances of that class. I’m having a
> > hard time and can’t even write a query that lists the number of
> > properties used for just one of the classes; the following just shows me
> > a series of ones.
> >
> > SELECT (COUNT(DISTINCT ?p) AS ?pcount)
> > WHERE {
> >?s a  .
> >?s ?p ?o .
> > }
> > GROUP BY ?p
> >
> > Any suggestions?
> >
> > Thanks,
> >
> > Bob
> >
> >
> 
>
> Founded in 1821, Heriot-Watt is a leader in ideas and solutions. With
> campuses and students across the entire globe we span the world, delivering
> innovation and educational excellence in business, engineering, design and
> the physical, social and life sciences. This email is generated from the
> Heriot-Watt University Group, which includes:
>
>   1.  Heriot-Watt University, a Scottish charity registered under number
> SC000278
>   2.  Heriot- Watt Services Limited (Oriam), Scotland's national
> performance centre for sport. Heriot-Watt Services Limited is a private
> limited company registered is Scotland with registered number SC271030 and
> registered office at Research & Enterprise Services Heriot-Watt University,
> Riccarton, Edinburgh, EH14 4AS.
>
> The contents (including any attachments) are confidential. If you are not
> the intended recipient of this e-mail, any disclosure, copying,
> distribution or use of its contents is strictly prohibited, and you should
> please notify the sender immediately and then delete it (including any
> attachments) from your system.
>


Re: Trying to count the properties used for each class

2022-01-25 Thread Gray, Alasdair
We defined a lot of useful statistics queries for datasets in §6.6 of the W3C 
HCLS Dataset Description Guidelines
https://www.w3.org/TR/hcls-dataset/#s6_6

I’ve made these available in a GitHub repo
https://github.com/AlasdairGray/HCLS-Stats-Queries

Hopefully you find these helpful

Alasdair
--
Alasdair J G Gray
Associate Professor in Computer Science,
School of Mathematical and Computer Sciences
Heriot-Watt University, Edinburgh, UK.

Email: a.j.g.g...@hw.ac.uk
Web: http://www.macs.hw.ac.uk/~ajg33
ORCID: http://orcid.org/-0002-5711-4872
Office: Earl Mountbatten Building 1.39
Twitter: @gray_alasdair


Heriot-Watt is a global University, as a result my working hours may not be 
your working hours. Do not feel pressure to reply to this email outside your 
working hours.


To arrange a meeting: 
https://outlook.office365.com/owa/calendar/alasdairg...@heriotwatt.onmicrosoft.com/bookings/

From: Nicola Vitucci 
Date: Monday, 24 January 2022 at 23:21
To: users@jena.apache.org 
Subject: Re: Trying to count the properties used for each class

Caution: This email originated from a sender outside Heriot-Watt University.
Do not follow links or open attachments if you doubt the authenticity of the 
sender or the content.



Hey Bob,

does this one do what you're after?

SELECT DISTINCT ?cl (COUNT(DISTINCT ?p) AS ?c)
WHERE {
  ?s a ?cl .
  ?s ?p ?o .
}
GROUP BY ?cl

Nicola

Il giorno lun 24 gen 2022 alle ore 23:05 Bob DuCharme  ha
scritto:

> Using arq and the data at
> http://www.snee.com/bobdc.blog/files/BeatlesMusicians.ttl, I’m trying to
> write a query that will list the classes used in the data and the number
> of distinct properties used by instances of that class. I’m having a
> hard time and can’t even write a query that lists the number of
> properties used for just one of the classes; the following just shows me
> a series of ones.
>
> SELECT (COUNT(DISTINCT ?p) AS ?pcount)
> WHERE {
>?s a  .
>?s ?p ?o .
> }
> GROUP BY ?p
>
> Any suggestions?
>
> Thanks,
>
> Bob
>
>


Founded in 1821, Heriot-Watt is a leader in ideas and solutions. With campuses 
and students across the entire globe we span the world, delivering innovation 
and educational excellence in business, engineering, design and the physical, 
social and life sciences. This email is generated from the Heriot-Watt 
University Group, which includes:

  1.  Heriot-Watt University, a Scottish charity registered under number 
SC000278
  2.  Heriot- Watt Services Limited (Oriam), Scotland's national performance 
centre for sport. Heriot-Watt Services Limited is a private limited company 
registered is Scotland with registered number SC271030 and registered office at 
Research & Enterprise Services Heriot-Watt University, Riccarton, Edinburgh, 
EH14 4AS.

The contents (including any attachments) are confidential. If you are not the 
intended recipient of this e-mail, any disclosure, copying, distribution or use 
of its contents is strictly prohibited, and you should please notify the sender 
immediately and then delete it (including any attachments) from your system.


Re: Trying to count the properties used for each class

2022-01-24 Thread Nicola Vitucci
Hey Bob,

does this one do what you're after?

SELECT DISTINCT ?cl (COUNT(DISTINCT ?p) AS ?c)
WHERE {
  ?s a ?cl .
  ?s ?p ?o .
}
GROUP BY ?cl

Nicola

Il giorno lun 24 gen 2022 alle ore 23:05 Bob DuCharme  ha
scritto:

> Using arq and the data at
> http://www.snee.com/bobdc.blog/files/BeatlesMusicians.ttl, I’m trying to
> write a query that will list the classes used in the data and the number
> of distinct properties used by instances of that class. I’m having a
> hard time and can’t even write a query that lists the number of
> properties used for just one of the classes; the following just shows me
> a series of ones.
>
> SELECT (COUNT(DISTINCT ?p) AS ?pcount)
> WHERE {
>?s a  .
>?s ?p ?o .
> }
> GROUP BY ?p
>
> Any suggestions?
>
> Thanks,
>
> Bob
>
>


Re: Trying to count the properties used for each class

2022-01-24 Thread Martynas Jusevičius
You're counting the same thing you're grouping by. I think you need:

SELECT ?c (COUNT(DISTINCT ?p) AS ?pcount)
WHERE {
   ?s a ?c .
   ?s ?p ?o .
}
GROUP BY ?c

http://sparql.org/sparql?query=SELECT+%3Fc+%28COUNT%28DISTINCT+%3Fp%29+AS+%3Fpcount%29%0D%0AWHERE+%7B%0D%0A+++%3Fs+a+%3Fc+.%0D%0A+++%3Fs+%3Fp+%3Fo+.%0D%0A%7D%0D%0AGROUP+BY+%3Fc=http%3A%2F%2Fwww.snee.com%2Fbobdc.blog%2Ffiles%2FBeatlesMusicians.ttl=text=%2Fxml-to-html.xsl

On Tue, Jan 25, 2022 at 12:05 AM Bob DuCharme  wrote:
>
> Using arq and the data at
> http://www.snee.com/bobdc.blog/files/BeatlesMusicians.ttl, I’m trying to
> write a query that will list the classes used in the data and the number
> of distinct properties used by instances of that class. I’m having a
> hard time and can’t even write a query that lists the number of
> properties used for just one of the classes; the following just shows me
> a series of ones.
>
> SELECT (COUNT(DISTINCT ?p) AS ?pcount)
> WHERE {
>?s a  .
>?s ?p ?o .
> }
> GROUP BY ?p
>
> Any suggestions?
>
> Thanks,
>
> Bob
>


Trying to count the properties used for each class

2022-01-24 Thread Bob DuCharme
Using arq and the data at 
http://www.snee.com/bobdc.blog/files/BeatlesMusicians.ttl, I’m trying to 
write a query that will list the classes used in the data and the number 
of distinct properties used by instances of that class. I’m having a 
hard time and can’t even write a query that lists the number of 
properties used for just one of the classes; the following just shows me 
a series of ones.


   SELECT (COUNT(DISTINCT ?p) AS ?pcount)
   WHERE {
  ?s a  .
  ?s ?p ?o .
   }
   GROUP BY ?p

Any suggestions?

Thanks,

Bob