Skip to content

Instantly share code, notes, and snippets.

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

Garzoni People Search

About person relations

#####Find all person knowing a certain person

SELECT ?x
WHERE
{
  ?x foaf:knows ?relstmt .
  ?relstmt grz-owl:value ?person.
  ?person rdfs:label "Nicolò Moretti".
}
Find all persons and their connection (foaf:knows) between minYear and maxYear
SELECT ?person1 ?person2
WHERE {
  ?person1 a grz-owl:Person .
  ?person1 foaf:knows ?relStmt . 
  ?relStmt sem:hasBeginTimeStamp ?date .
  ?relStmt grz-owl:value ?person2 .
  FILTER (year(?date) > minYear AND year(?date) < maxYear)
}
Get relations and their respective occurrence number
SELECT ?rel count(?rel)
WHERE 
{
  ?pers1 a grz-owl:Person .
  ?pers2 a grz-owl:Person .
  ?relStmt a grz-owl:Statement .
  ?pers1 ?rel ?relStmt .
  ?relStmt grz-owl:value ?pers2 .
} 
ORDER BY DESC(count(?rel))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment