So I have an RDF schema that contains many "groups", and each of these groups has a "name", and contains a number of "elements". I need to select the name of every group, along with the number of elements for each. Here is a sample of a group RDF schema...
<Group rdf:ID="group_actinoid">
<name rdf:datatype="&xsd;string">Actinoid</name>
<element rdf:resource="#Ac"/>
<element rdf:resource="#Th"/>
<element rdf:resource="#Pa"/>
<element rdf:resource="#U"/>
<element rdf:resource="#Np"/>
<element rdf:resource="#Pu"/>
<element rdf:resource="#Am"/>
<element rdf:resource="#Cm"/>
<element rdf:resource="#Bk"/>
<element rdf:resource="#Cf"/>
<element rdf:resource="#Es"/>
<element rdf:resource="#Fm"/>
<element rdf:resource="#Md"/>
<element rdf:resource="#No"/>
</Group>
...and here's the query I've been trying to get to work...
1 PREFIX pt:<http://www.daml.org/2003/01/periodictable/PeriodicTable#>
2 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
3 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
4 PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
5
6 SELECT (SAMPLE(?name) AS ?NAME) (COUNT(?elem) AS ?ELEMENTCOUNT)
7 WHERE {
8 ?group rdf:type pt:Group .
9 ?group pt:name ?name .
10 ?elem pt:element ?group .
11 }
12 GROUP BY ?group
...but I'm getting an empty result and I'm not really sure why. I should be getting a group name, along with however many elements that group contains, for every group in the owl file.