The SPARQL plug-in for Genesis provides a view in which the user can enter and interact with the results of SPARQL queries over the local data cache. It can be installed by searching for new features to install from the following update site:
| Name: | Distributed Family Tree Project Update |
| URL: | http://www.dftproject.org/updates/
|
In order to help the user understand what kind of data is available to query over, the following ontologies are given. The data model is continually evolving, so these definitions are only valid for a specific version of Genesis (last updated to reflect Genesis 0.0.20).
Note: The SPARQL plug-in is very slow. This is because it is not optimized to take advantage of joins in the underlying database. The plug-in is intended to be used for inspecting and debugging the data, not as a means to efficiently access it. That being said, anyone who wants to take a stab at optimizing it is more than welcome.
# Base: http://purl.org/net/genealogy-core# @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . <http://purl.org/net/genealogy-core#> a owl:Ontology ; rdfs:comment "The core data model for human genealogy."^^xsd:string . :Individual a owl:Class ; rdfs:comment "An individual person."^^xsd:string . :name a owl:ObjectProperty ; rdfs:comment "Relates an individual to their name."^^xsd:string ; rdfs:domain :Individual . :gender a owl:ObjectProperty ; rdfs:comment "Relates an individual to their gender."^^xsd:string ; rdfs:domain :Individual . :born a owl:ObjectProperty ; rdfs:comment "Relates an individual to the birth event at which they were born."^^xsd:string ; rdfs:domain :Individual ; rdfs:range :Birth . :married a owl:ObjectProperty ; rdfs:comment "Relates an individual to the marriage event where they were married."^^xsd:string ; rdfs:domain :Individual ; rdfs:range :Marriage . :gaveBirth a owl:ObjectProperty ; rdfs:comment "Relates an individual to the birth event where they were the birth mother of the child."^^xsd:string ; rdfs:domain :Individual ; rdfs:range :Birth . :fathered a owl:ObjectProperty ; rdfs:comment "Relates an individual to the birth event where they were the birth father of the child."^^xsd:string ; rdfs:domain :Individual ; rdfs:range :Birth . :died a owl:ObjectProperty ; rdfs:comment "Relates an individual to the death event where they died."^^xsd:string ; rdfs:domain :Individual ; rdfs:range :Death . :buried a owl:ObjectProperty ; rdfs:comment "Relates an individual to the burial event at which they were buried."^^xsd:string ; rdfs:domain :Individual ; rdfs:range :Burial . :Event a owl:Class ; rdfs:comment "An event."^^xsd:string . :place a owl:ObjectProperty ; rdfs:comment "Relates an event to the place where it occurred."^^xsd:string ; rdfs:domain :Event . :date a owl:ObjectProperty ; rdfs:comment "Relates an event to the date it occurred."^^xsd:string ; rdfs:domain :Event . :Birth a owl:Class ; rdfs:comment "A birth event."^^xsd:string ; rdfs:subClassOf :Event . :Marriage a owl:Class ; rdfs:comment "A marriage event."^^xsd:string ; rdfs:subClassOf :Event . :Death a owl:Class ; rdfs:comment "A death event."^^xsd:string ; rdfs:subClassOf :Event . :Burial a owl:Class ; rdfs:comment "A burial event."^^xsd:string ; rdfs:subClassOf :Event .
# Base: http://purl.org/net/genealogy-provenance# @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . <http://purl.org/net/genealogy-provenance#> a owl:Ontology ; rdfs:comment "The provenance data model for human genealogy."^^xsd:string . :Source a owl:Class ; rdfs:comment "A source."^^xsd:string . :source a owl:ObjectProperty ; rdfs:comment "Relates a graph of data to the source of that data."^^xsd:string ; rdfs:range :Source .
Fetch all statements in the data store (subject/predicate/object triple + graph):
SELECT ?Graph ?Subject ?Predicate ?Object WHERE { GRAPH ?Graph { ?Subject ?Predicate ?Object } }
Fetch the URI and name of all the individuals:
PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#> PREFIX gc: <http://purl.org/net/genealogy-core#> SELECT * WHERE { ?Resource rdf:type gc:Individual ; gc:name ?Name }
Fetch the names of all male individuals with "Adam" in their name:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX gc: <http://purl.org/net/genealogy-core#> SELECT ?Name WHERE { ?Resource rdf:type gc:Individual ; gc:name ?Name ; gc:gender "M" . FILTER regex(?Name, "Adam", "i") }
Fetch the names of all individuals, along with their birthdates when available:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX gc: <http://purl.org/net/genealogy-core#> SELECT ?Name ?Birthdate WHERE { ?Resource rdf:type gc:Individual ; gc:name ?Name . OPTIONAL { ?Resource gc:born [ gc:date ?Birthdate ] } }