introduction to protégé for absolute beginners
DESCRIPTION
Introduction to Protégé for Absolute Beginners. University at Buffalo August 11 & 12. SPARQL Protocol and RDF Query Language. SPARQL – SPARQL Protocol and RDF Query Language. A query language that is able to retrieve and manipulate data stored in RDF format. - PowerPoint PPT PresentationTRANSCRIPT
Introduction to Protégé for Absolute Beginners
University at BuffaloAugust 11 & 12
SPARQL PROTOCOL AND RDF QUERY LANGUAGE
SPARQL – SPARQL Protocol and RDF Query Language
• A query language that is able to retrieve and manipulate data stored in RDF format.
• On 15 January 2008, SPARQL 1.0 became an official W3C Recommendation
• A new version of SPARQL, 1.1 is under review ending on August 21, 2012
SPARQL Graph Matching
?
The Structure of a Basic SPARQL Query
• The select clause lists the information you want to see. – For example: player, token
• The where clause is a set of statements that pulls the information– For example: player represented by token
Key Terms for Use in Queries
• rdfs:subClassOf will return the direct subclasses of another class
• rdfs:subClassOf* will return the recursive subclasses of another class
• rdf:type will return or set the class/kind of an instance
• Prefixes:PREFIX mnply:<http://www.cubrc.org/ontologies/MonopolyOntology#>PREFIX
game1:<http://www.cubrc.org/ontologies/MonopolyOntologies/Game1#>
Example Queries
• Return all playersSELECT ?playerWHERE {
?player rdf:type mnply:MonopolyPlayer .}
• Return all players and their game tokensSELECT ?player ?tokenWHERE {
?player mnply:represented_by ?token .}
Example Queries• The previous query made impervious to changes by adding types
SELECT ?player ?tokenWHERE {
?player rdf:type mnply:MonopolyPlayer .?token rdf:type mnply:MonopolyToken .?player mnply:represented_by ?token .
}
• Return all the events a given player participates inSELECT ?eventWHERE {
?event rdf:type mnply:MonopolyEvent . ?event mnply:has_participant game1:MonopolyPlayer_1.
}
Example Queries• Return all the dice rolls along with whether or not they were doubles
SELECT ?roll ?double WHERE {
?roll rdf:type mnply:MonopolyRollOfDice .?double mnply:assessed_at ?roll .?double rdf:type mnply:MonopolyDoubles} .
}
• The above returned just the doubles, to get all the rolls use the OPTIONAL keywordSELECT ?roll ?double WHERE {
?roll rdf:type mnply:MonopolyRollOfDice .OPTIONAL {?double mnply:assessed_at ?roll . ?double rdf:type mnply:MonopolyDoubles} .
}
Example Queries
• Return all the locations of a player in “temporal” order
SELECT ?ordval ?round ?turn ?locationWHERE {
?attribute mnply:attribute_of game1:MonopolyPlayer_1 .?attribute mnply:located_at ?location .?attribute mnply:assessed_at ?turn .?turn mnply:occurs_during ?round .?round mnply:has_ordinal_value ?ordval .
} ORDER BY ?ordval
Example Queries
• What were the locations of all players at the end of Round 11?
SELECT ?player ?round ?turn ?locationWHERE {
?player rdf:type mnply:MonopolyPlayer .?attribute mnply:attribute_of ?player .?attribute mnply:located_at ?location .?attribute mnply:assessed_at ?turn .?turn mnply:occurs_during ?round .?round mnply:has_ordinal_value 11 .
}
Example Queries• What were player 1’s locations at the end of Rounds 11 and 20?
SELECT ?player ?round ?turn ?locationWHERE {{
?attribute mnply:attribute_of game1:MonopolyPlayer_1 .?attribute mnply:located_at ?location .?attribute mnply:assessed_at ?turn .?turn mnply:occurs_during ?round .?round mnply:has_ordinal_value 11 .
}UNION{
?attribute mnply:attribute_of game1:MonopolyPlayer_1 .?attribute mnply:located_at ?location .?attribute mnply:assessed_at ?turn .?turn mnply:occurs_during ?round .?round mnply:has_ordinal_value 20} .
}
}
Example Queries
• Return the number of each type of equipment used in the game
SELECT ?equipmenttype (COUNT(?equipment) AS ?equipmentcount)WHERE {
?equipmenttype rdfs:subClassOf mnply:MonopolyEquipment .?equipment rdf:type ?equipmenttype .?attribute mnply:attribute_of ?player .?attribute mnply:located_at game1:MonopolyBoardwalk_Instance_1 .
}GROUP BY ?equipmenttype
MISCELLANEOUS TECHNOLOGIES
Ontofox
• OntoFox is a web-based system to support ontology reuse. It allows users to input terms, fetch selected properties, annotations, and certain classes of related terms from source ontologies and save the results using the RDF/XML serialization of the OWL.
• http://ontofox.hegroup.org/
(One way of) Using Ontofox• Identify an ontology from which you wish to extract terms
– (e.g. Environment Ontology http://purl.bioontology.org/ontology/ENVO )• Get the full id of the lowest level terms
– (e.g. http://purl.obolibrary.org/obo/ENVO_00002021– http://purl.obolibrary.org/obo/ENVO_00002022, etc.
• Get the full id of the highest level term– (http://purl.obolibrary.org/obo/ENVO_00002297)
• Select a setting for retrieving intermediate terms – (e.g. IncludeAllIntermediates)
• Input URI for annotations to be selected – (e.g. http://www.w3.org/2000/01/rdf-schema#label)
• Enter a URI for the output file – (e.g. http://purl.obolibrary.org/obo/external/ENVO_extract.owl)