Skip to content

Instantly share code, notes, and snippets.

@e-maud
Last active January 30, 2017 08:29
Show Gist options
  • Save e-maud/ccc51c2e319f609746d7 to your computer and use it in GitHub Desktop.
Save e-maud/ccc51c2e319f609746d7 to your computer and use it in GitHub Desktop.

Garzoni geography: about workshops, and others

# workshop mentions
SELECT (COUNT (distinct ?wm) AS ?workshopMention) 
WHERE
{ ?wm a grz-owl:WorkshopMention .}
Show workshop locations (all infos)
SELECT ?wm ?parish ?sestriere ?locDescription ?insigna
WHERE
{
  ?wm a grz-owl:WorkshopMention .
  OPTIONAL 
  {
    ?workshop grz-owl:location ?locWorkShop .
    OPTIONAL {?locWorkShop grz-owl:in_parish ?workshopParish . ?workshopParish rdfs:label ?parish }
    OPTIONAL {?locWorkShop grz-owl:in_sestriere ?workshopSestriere  . ?workshopSestriere rdfs:label ?sestriere}
    OPTIONAL {?locWorkShop grz-owl:writtenForm ?locDescription .}
  }
  OPTIONAL {?wm grz-owl:insigna ?insigna . }
}
Distribution of workshop (mentions) per parish (ok)
SELECT ?parish COUNT (distinct ?wm)
WHERE
{
  ?wm a grz-owl:WorkshopMention .
  ?wm grz-owl:location/grz-owl:in_parish ?parish . 
}
GROUP BY ?parish
ORDER BY DESC (COUNT (distinct ?wm))
Information on current sample (Flag “You are looking at ...”), i.e. # workshops with parish:
SELECT  COUNT (distinct ?workshop)
WHERE
{
?workshop a grz-owl:WorkshopMention.
?workshop grz-owl:location ?loc .
FILTER (EXISTS {?loc grz-owl:in_parish ?parish}) .
}
Distribution of workshop (mentions) per sestriere (ok)
SELECT ?sestriere COUNT (distinct ?wm)
WHERE
{
  ?wm a grz-owl:WorkshopMention .
  ?wm grz-owl:location/grz-owl:in_sestriere ?sestriere . 
}
GROUP BY ?sestriere
Information on current sample (Flag “You are looking at ...”), i.e. # workshops with sestriere:
SELECT  COUNT (distinct ?workshop)
WHERE
{
?workshop a grz-owl:WorkshopMention.
?workshop grz-owl:location ?loc .
FILTER (EXISTS {?loc grz-owl:in_sestriere ?sestriere}) .
}
Stats on workshop (mentions) description: parish and sestriere infos
SELECT (COUNT (distinct ?wmWithParish) AS ?WorkshopMentionWithParishOnly) (COUNT (distinct ?wmWithSestriere) AS ?WorkshopMentionWithSestriereOnly) (COUNT (distinct ?wmWithParishAndSestriere)  AS ?WorkshopMentionWithBoth)
WHERE
{
  ?wmWithParish a grz-owl:WorkshopMention .
  ?wmWithParish grz-owl:location/grz-owl:in_parish ?a . 
  MINUS {?wmWithParish grz-owl:location/grz-owl:in_sestriere ?b . }
  
  ?wmWithSestriere a grz-owl:WorkshopMention .
  ?wmWithSestriere grz-owl:location/grz-owl:in_sestriere ?c . 
  MINUS {?wmWithSestriere grz-owl:location/grz-owl:in_parish ?d . }
  
  ?wmWithParishAndSestriere a grz-owl:WorkshopMention .
  ?wmWithParishAndSestriere grz-owl:location/grz-owl:in_sestriere ?e . 
  ?wmWithParishAndSestriere grz-owl:location/grz-owl:in_parish ?f .
}
Stats on workshop (mentions) description: loc description and all loc infos (sest + par + loc desc)
SELECT (COUNT (distinct ?wmWithLocDescription)  AS ?WorkshopMentionWithLocDescriptionOnly) (COUNT (distinct ?wmWithAllLoc)  AS ?WorkshopMentionWithThree)
WHERE
{
  ?wmWithLocDescription a grz-owl:WorkshopMention .
  ?wmWithLocDescription grz-owl:location/grz-owl:writtenForm ?h . 
  MINUS {?wmWithLocDescription grz-owl:location/grz-owl:in_sestriere ?i . }
  MINUS {?wmWithLocDescription grz-owl:location/grz-owl:in_parish ?j . }
  
  ?wmWithAllLoc a grz-owl:WorkshopMention .
  ?wmWithAllLoc grz-owl:location/grz-owl:in_sestriere ?k . 
  ?wmWithAllLoc grz-owl:location/grz-owl:in_parish ?l . 
  ?wmWithAllLoc grz-owl:location/grz-owl:writtenForm ?m . 
}
Stats on workshop (mentions) description: number of wm + insigna
SELECT (COUNT (distinct ?wm)  AS ?WorkshopMention) (COUNT (distinct ?wmWithInsigna)  AS ?WorkshopMentionWithInsigna)
WHERE
{
  ?wmWithInsigna a grz-owl:WorkshopMention .
  ?wmWithInsigna grz-owl:insigna  ?i .
  ?wm a grz-owl:WorkshopMention .
}
Who has geographical origins?
SELECT STRAFTER(STR(?role), "ontology#") AS ?Role  COUNT (distinct ?geo)
WHERE
{
?pm a grz-owl:PersonMention.
?pm grz-owl:role/grz-owl:roleType ?role .
?pm grz-owl:geographicOrigin ?geo .
}
GROUP BY (?role)
Who has a residence?
SELECT STRAFTER(STR(?role), "ontology#") AS ?Role  COUNT (distinct ?geo)
WHERE
{
?pm a grz-owl:PersonMention.
?pm grz-owl:role/grz-owl:roleType ?role .
?pm grz-owl:residence ?geo .
}
GROUP BY (?role)
Geographical origins by role
SELECT STR(?wf) AS ?GeoOriginWrittenForm STR(?sf) AS ?GeoOriginStandardForm 
WHERE
{
  ?app  a grz-owl:PersonMention .
  ?app grz-owl:role/grz-owl:roleType  grz-owl:apprentice .
  ?app  grz-owl:geographicOrigin ?geoOrigin .
  OPTIONAL {?geoOrigin grz-owl:standardForm ?sf . }
  ?geoOrigin grz-owl:writtenForm ?wf .
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment