Lab: OWL 2: Difference between revisions

From info216
(Created page with "==Topics== * Basic OWL ontology editing in Protégé. * WebVOWL visualisation. ==Useful materials== Readings: * [https://protege.stanford.edu/ Protégé page] use either ''We...")
 
 
(18 intermediate revisions by 2 users not shown)
Line 5: Line 5:
==Useful materials==
==Useful materials==
Readings:
Readings:
* [https://protege.stanford.edu/ Protégé page] use either ''Webprotégé'' (simplest) or the ''download'' (more powerful) version
* [https://protegeproject.github.io/protege/ Protégé 5 Documentation]
* [https://www.w3.org/TR/owl-ref/ OWL Documentation]  
** [https://protegeproject.github.io/protege/installation/ Installation]
** [https://protegeproject.github.io/protege/getting-started/ Getting Started]
** An online version, [https://protege.stanford.edu/products.php#web-protege Webprotégé], is also available, but we recommend that you download the Desktop version and run it locally.
* [https://www.youtube.com/playlist?list=PLea0WJq13cnAfCC0azrCyquCN_tPelJN1 Youtube Playlist with quick tutorials of Protégé, particularly video 1 - 5]
* [https://www.w3.org/TR/owl-ref/ OWL Documentation] (from S09)
* [https://docs.google.com/presentation/d/17iS--yTuKzccP2k7Nqu0TnFJH2XJczhgufJ69rFrsfM Lab presentation of Protégé]


Vocabularies and terms:
Vocabularies and terms (from S10) - ''this is for reference: you will not need them all :-)'':
* FOAF
* [http://xmlns.com/foaf/0.1/ Friend of a Friend (FOAF)] (if necessary follow the link to the 2004 version)
* Geo
* [http://motools.sourceforge.net/event/event.html Event Ontology (event)]
* Event
* [http://www.w3.org/TR/owl-time/ Time ontology in OWL (time, OWL-time)]
* OWL-Time
* [https://www.w3.org/2003/01/geo/ geo: World Geodetic Standard (WGS) 84]
* DC
* [http://dublincore.org/ Dublin Core (DC)]
* SIOC
* [http://www.w3.org/2004/02/skos/ SKOS - Simple Knowledge Organization System Home Page]
* SKOS
* [http://rdfs.org/sioc/spec/ Semantic Interlinked Online Communities (SIOC)]


==Tasks==
==Tasks==
In this exercise, you can continue with the ontology you create in [Lab: OWL 1 | the OWL 1 lab] or use the (very incomplete) one below.  
'''Task.''' Follow the [https://protegeproject.github.io/protege/installation/ Protégé 5 Installation instructions] to download and install Protégé Desktop.


''Tip:'' When you save OWL files as XML, the extension ''.owl-xml'' can be used.
'''Task.''' Go through the [https://protegeproject.github.io/protege/getting-started/ Protégé 5 Getting Started advice] to learn the basics of Protégé Desktop.  


===Preparations===
'''Task.''' Create a new InvestigationOntology that can be used to represent the Mueller Investigation, as well as other public investigations. Choose a prefix (for example ''io:'') path for the ontology, and save the empty ontology to a file.
'''Task: the Webprotégé (simplest) alternative'''
Inspect your ontology with [https://webprotege.stanford.edu/ Webprotégé].
* Register as a new user and log in.  
* ''Create a new project'' and use ''Create from existing sources'' to upload your OWL/XML file.  


'''Task: the download (more powerful alternative'''
'''Task.'''  
* [https://protege.stanford.edu/products.php Download Protégé] for free and run it on your local machine. The stand-alone version is even more powerful with lots of plug-ins.
Start adding classes and properties to your ontology. Use the experience from earlier exercises. For example, the ontology can include these top-level classes:
* Go to ''File -> Open'' and load your OWL/XML file.
* Investigation
* Person
Subclasses of Person can be
* Investigator
* InvestigatedPerson
A subclass of Investigator can be InvestigationLeader.


'''Task.'''
'''Task.''' Connect your classes to at least one class from a well-known ontology, for example foaf:Person. There are three ways you can do this do this:
Most likely, your ontology is still quite disconnected.  
# use foaf:Person instead of "your own" Person class;
* Add ''rdfs:subClassOf'', ''rdfs:domain'', and ''rdfs:range'' triples to turn it into a more connected graph that represents the domain. <!-- Calculate owlrl closures to see the effects of your triples as you add them. -->
# make "your own" Person class an rdfs:subClassOf foaf:Person; or
* Now and later, save your ontology often to a local XML file, and visualise it using [http://vowl.visualdataweb.org/webvowl.html WebVOWL]. The purpose of WebVOWL is to visualise classes and their properties, so the individuals may not show. (If the current version linked on the WebVOWL page has stopped, there is also a link to a more stable older backup version.)
# make "your own" Person class owl:equivalentClass to foaf:Person.
Alternative 2 is most common but all are ok.


'''Task.'''
''Hint 1:'' You must first create ''foaf:Person'' as a class in your ontology.
Continue to extend your ontology by adding concepts from standard ontologies such as:
''Hint 2:'' Use the ''Ontology Prefixes'' sub-tab in the ''Active ontology'' tab to define a new prefix.
* FOAF, Event Ontology, SKOS, DC, OWL-Time, etc.


===Triples you can use to get started===
'''Task.''' Create or reuse data properties for
<syntaxhighlight>
* investigation title and description;
@prefix ex: <http://example/org#> .
* person names; and
* investigation start and end times.


ex:Mueller_Investigation ex:involved ex:George_Papadopoulos,
''Hint:'' To reuse a property from another vocabulary, you need to create it as a property in your ontology.
        ex:Michael_Cohen,
        ex:Michael_Flynn,
        ex:Paul_Manafort,
        ex:Rick_Gates,
        ex:Roger_Stone ;
    ex:leadBy ex:Robert_Mueller .


ex:Michael_Cohen ex:attorneyFor ex:Donald_Trump ;
'''Task,''' Define the proper domains and ranges of your data properties. Should some of them be marked as ''Functional''?
    ex:pleadedGuilty ex:Michael_Cohens_Lying .


ex:Michael_Cohens_Lying a ex:Lying ;
'''Task.''' Along the way, keep saving the ontology to a file, and use [http://vowl.visualdataweb.org/webvowl.html WebVOWL] to visualise it (either ''Run WebVOWL'' or ''Old WebVOWL version''). Keep improving the ontology until it looks the way you think it should.
    ex:wasLyingAbout ex:Trump_RealEstateDeal ;
    ex:wasLyingTo ex:Congress .


ex:Michael_Flynn ex:adviserTo ex:Donald_Trump ;
'''Task.''' Also along the way, go to the ''Reasoner'' menu and choose the ''HermiT'' reasoner. Use ''Reasoner -> Start reasoner'' to check that your ontology is consistent.
    ex:negotiatedAgreement ex:PleaAgreement ;
    ex:pleadedGuilty ex:Michael_Flynns_Lying .


ex:Michael_Flynns_Lying a ex:Lying ;
''Tip:'' When you change the ontology and the reasoner is running, you must use ''Reasoner -> Synchronize'' to reason over the changes.
    ex:wasLyingTo ex:FBI .


ex:Paul_Manafort ex:campaignManager ex:Donald_Trump ;
'''Task.'''
    ex:chargedWith ex:ForeignLobbying,
* Create or import object properties for stating that a person is ''involved in'' an investigation.
        ex:MoneyLaundering,
* Create subproperties of ''involved in'' for stating that a person can be ''indicted in'', ''investigating'', or ''leading'' an investigation.
        ex:TaxEvasion ;
    ex:convictedFor ex:BankAndTaxFraud ;
    ex:hasBusinessPartner ex:Rick_Gates ;
    ex:negotiatedAgreement ex:PleaAgreement ;
    ex:pleadedGuilty ex:Conspiracy ;
    ex:sentencedTo ex:Prison .


ex:Rick_Gates_Lying a ex:Lying ;
'''Task.''' Define the proper domains and ranges of your object properties. Should some of them have particular ''Characteristics''?
    ex:wasLyingTo ex:FBI .


ex:Rick_Gates ex:chargedWith ex:ForeignLobbying,
==If you have more time==
        ex:MoneyLaundering,
'''Task.''' Stop the reasoner, and add individuals to represent that:
        ex:TaxEvasion ;
* Robert Mueller lead the Mueller Investigation.
    ex:pleadedGuilty ex:Conspiracy,
* Paul Manafort was indicted.
        ex:Rick_Gates_Lying .
* Elizabeth Prelogar was an investigator.
</syntaxhighlight>
 
'''Task.''' Start the reasoner again. Have any axioms/triples been added to the ontology?
 
'''Task.''' Can you do a change that makes your ontology inconsistent? (Save often, so you always have a consistent version to revert to :-))


==If you have more time==
'''Task.'''
TBD
You can add a lot more classes (types) and relations (object properties) to your ontology. For example:
* InvestigationTeam, which has all the Investigators as members

Latest revision as of 14:10, 17 April 2024

Topics

  • Basic OWL ontology editing in Protégé.
  • WebVOWL visualisation.

Useful materials

Readings:

Vocabularies and terms (from S10) - this is for reference: you will not need them all :-):

Tasks

Task. Follow the Protégé 5 Installation instructions to download and install Protégé Desktop.

Task. Go through the Protégé 5 Getting Started advice to learn the basics of Protégé Desktop.

Task. Create a new InvestigationOntology that can be used to represent the Mueller Investigation, as well as other public investigations. Choose a prefix (for example io:) path for the ontology, and save the empty ontology to a file.

Task. Start adding classes and properties to your ontology. Use the experience from earlier exercises. For example, the ontology can include these top-level classes:

  • Investigation
  • Person

Subclasses of Person can be

  • Investigator
  • InvestigatedPerson

A subclass of Investigator can be InvestigationLeader.

Task. Connect your classes to at least one class from a well-known ontology, for example foaf:Person. There are three ways you can do this do this:

  1. use foaf:Person instead of "your own" Person class;
  2. make "your own" Person class an rdfs:subClassOf foaf:Person; or
  3. make "your own" Person class owl:equivalentClass to foaf:Person.

Alternative 2 is most common but all are ok.

Hint 1: You must first create foaf:Person as a class in your ontology. Hint 2: Use the Ontology Prefixes sub-tab in the Active ontology tab to define a new prefix.

Task. Create or reuse data properties for

  • investigation title and description;
  • person names; and
  • investigation start and end times.

Hint: To reuse a property from another vocabulary, you need to create it as a property in your ontology.

Task, Define the proper domains and ranges of your data properties. Should some of them be marked as Functional?

Task. Along the way, keep saving the ontology to a file, and use WebVOWL to visualise it (either Run WebVOWL or Old WebVOWL version). Keep improving the ontology until it looks the way you think it should.

Task. Also along the way, go to the Reasoner menu and choose the HermiT reasoner. Use Reasoner -> Start reasoner to check that your ontology is consistent.

Tip: When you change the ontology and the reasoner is running, you must use Reasoner -> Synchronize to reason over the changes.

Task.

  • Create or import object properties for stating that a person is involved in an investigation.
  • Create subproperties of involved in for stating that a person can be indicted in, investigating, or leading an investigation.

Task. Define the proper domains and ranges of your object properties. Should some of them have particular Characteristics?

If you have more time

Task. Stop the reasoner, and add individuals to represent that:

  • Robert Mueller lead the Mueller Investigation.
  • Paul Manafort was indicted.
  • Elizabeth Prelogar was an investigator.

Task. Start the reasoner again. Have any axioms/triples been added to the ontology?

Task. Can you do a change that makes your ontology inconsistent? (Save often, so you always have a consistent version to revert to :-))

Task. You can add a lot more classes (types) and relations (object properties) to your ontology. For example:

  • InvestigationTeam, which has all the Investigators as members