More SPARQL Queries

On this page we give more examples of SPARQL queries.

Please post all questions about using SymbolicData Tools and Data on the SymbolicData Mailing List.

See QuickStart for a more detailed explanation of SPARQL Queries or any of the SPARQL tutorials or references at

Examples from TestSets Metadata (Normaliz Project)

List

  PREFIX sd: <http://symbolicdata.org/Data/Model#>
  select 
  distinct ?l ?r ?nc ?nr ?ner ?nhbe ?npb ?nsb
  from <http://symbolicdata.org/Data/TestSets/>
  where {
     ?p a sd:TestSet ; rdfs:label ?l . 
     optional { ?p sd:hasRank ?r . }	
     optional { ?p sd:numberOfColumns ?nc . }		
     optional { ?p sd:numberOfRows ?nr . }	
     optional { ?p sd:hasNumberOfExtremeRays ?ner . }		
     optional { ?p sd:hasNumberOfHilbertBasisElements ?nhbe . }		
     optional { ?p sd:hasNormalizPrimaryBase ?npb . }
     optional { ?p sd:hasNormalizSDBase ?nsb . }
     filter regex(?p, "graph")
  }
  order by ?l

Run this query

Examples from Polytopes Metadata

List for all Fano Polytopes

     PREFIX sd: <http://symbolicdata.org/Data/Model#> 
     select ?a ?v ?cd ?nfc ?fn
     from <http://symbolicdata.org/Data/FanoPolytopes/>
     where {
       	   ?a a sd:FanoPolytope ;
       	   sd:cone_dim ?cd ; sd:n_facets ?nfc ; sd:hasFileName ?fn ; 
       	   sd:lattice_volume ?v . 
       	   filter ((xsd:integer(?v)<100) and (xsd:integer(?nfc)<7))
     }

Run this query

List

   PREFIX sd: <http://symbolicdata.org/Data/Model#> 
   select ?n ?v ?fn
   from <http://symbolicdata.org/Data/BirkhoffPolytopes/>
   where {
   ?a a sd:BirkhoffPolytope ;
   sd:hasNodes ?n ; sd:hasVertices ?v; sd:hasPolymakeFile ?fn . 
   filter ((xsd:integer(?n)=4) and (xsd:integer(?v)<=20))
   }
   order by desc(xsd:integer(?v))

Run this query

Examples from Transitive Groups Metadata

List

   PREFIX sd: <http://symbolicdata.org/Data/Model#> 
   select ?n ?o ?url
   from <http://symbolicdata.org/Data/TransitiveGroups/>
   where {
   ?a a sd:TransitiveGroup ; 
   sd:hasProperty sd:nilpotent; sd:hasName ?n ; sd:hasOrder ?o ;
   sd:hasURL ?url .  
   filter (xsd:integer(?o)=32)
   }

Run this query

Number of nilpotent transitive groups (order, count) in the database of given order.

   PREFIX sd: <http://symbolicdata.org/Data/Model#> 
   select ?o as ?order count(?a) as ?count
   from <http://symbolicdata.org/Data/TransitiveGroups/>
   where {
   ?a a sd:TransitiveGroup ; 
   sd:hasProperty sd:nilpotent; sd:hasOrder ?o .  
   }

Run this query

Inspect the special examples (uri, external link to the Group Database) of a nilpotent group of order 162.

   PREFIX sd: <http://symbolicdata.org/Data/Model#> 
   select ?a ?url
   from <http://symbolicdata.org/Data/TransitiveGroups/>
   where {
   ?a a sd:TransitiveGroup ; sd:hasURL ?url; 
   sd:hasProperty sd:nilpotent; sd:hasOrder 162 .  
   }

Run this query