Lab: OWL 1: Difference between revisions

From info216
No edit summary
No edit summary
Line 19: Line 19:


==Tasks==
==Tasks==
In earlier labs you modelled and programmed the following situations:


In RDF: "Cade Tracy lives in 1516 Henry Street, Berkeley, California 94709, USA. He has a B.Sc. in biology
from the University of California, Berkeley from 2011. His interests include birds, ecology, the environment,
photography and travelling. He has visited Canada and France. Emma Dominguez lives in Carrer de la Guardia
Civil 20, 46020 Valencia, Spain. She has a M.Sc. in chemistry from the University of Valencia from 2015.
Her areas of expertise include waste management, toxic waste, air pollution. Her interests include bike
riding, music and travelling. She has visited Portugal, Italy, France, Germany, Denmark and Sweden. Cade
knows Ines. They met in Paris in August 2014."


In RDFS: "University of California, Berkeley and University of Valencia are both Universities.
Extend the RDF and RDFS graphs from earlier to account for the following situation:
All universities are higher education instituttions (HEIs). Having a B.Sc. from a HEI and having a M.Sc.
from a HEI are special cases of gradutating from that HEI. That a person has a degree in a subject means
that the person has expertise in that subject. Only persons can have expertise, and what they have expertise
about is always a subject."


Extend the RDF and RDFS graphs from earlier to account for the following situation:
'''Consider the following situtations:'''
Cade and Emma are two different persons. All the countries mentioned above are different. The country USA above is
Cade and Emma are two different persons. All the countries mentioned above are different. The country USA above is
the same as the DBpedia resource http://dbpedia.org/resource/United_States (dbr:United_States) and the GeoNames
the same as the DBpedia resource http://dbpedia.org/resource/United_States (dbr:United_States) and the GeoNames
Line 48: Line 36:
inverse of a subproperty of "based near".)
inverse of a subproperty of "based near".)


Look through your graph and try to identify at least one of each: a reflexive and an irreflexive, a symmetric and
'''Create a graph from this scenario using OWL triples in RDFlib..''' If you can, try to build on your example from labs 2 and 3!
an asymmetric, as well as a transitive property.
 
 
Look through the predicates(properties) above and make new triples for each one that describing them as any of the following: a reflexive , irreflexive, symmetric, asymmetric, or a transitive property.
 


'''Create and output the OWL ontology in RDFlib.''' If you can, try to build on your example from labs 2 and 3!


Write the ontology to a TURTLE file, and try to visualise it using http://visualdataweb.de/webvowl/ . WebVOWL is oriented towards visualising classes and their properties, so the individuals may not show.
Write the ontology to a TURTLE file, and try to visualise it using http://visualdataweb.de/webvowl/ . WebVOWL is oriented towards visualising classes and their properties, so the individuals may not show.


Use OntModel.writeAll() to write out the whole ontology, including OWL's built-in axioms (note that sending it to WebVOWL may not work.) Add a reasoner to your OntModel, for example ModelFactory.createOntology(OntModelSpec.OWL_MEM_RULE_INF), and writeAll() again. Can you spot any inferences?
Use OntModel.writeAll() to write out the whole ontology, including OWL's built-in axioms (note that sending it to WebVOWL may not work.) Add a reasoner to your OntModel, for example ModelFactory.createOntology(OntModelSpec.OWL_MEM_RULE_INF), and writeAll() again. Can you spot any inferences?

Revision as of 16:07, 4 March 2020

Lab 7: RDFS Plus

Topics

RDF Plus sketching. WebVOWL visualisation. Basic OWL ontology programming in Jena.

Tutorial

Tutorial for the Jena-programming part: https://jena.apache.org/documentation/ontology/

Classes/interfaces (some in package org.apache.jena.ontology)

  • ModelFactory (createOntologyModel),
  • OWL (sameAs, equivalentClass, equivalentProperty, differentFrom, disjointWith, inverseOf)
  • OntModel (createClass, createIndividual, createObjectProperty, CreateDatatypeProperty, createAllDifferent, createSymmetricProperty, createTransitiveProperty, createInverseFunctionalProperty),
  • Model (createList, write),
  • OntClass, Individual, DatatypeProperty, ObjectProperty

Note that the OntModel interface extends InfModel and Model.

Tasks

Extend the RDF and RDFS graphs from earlier to account for the following situation:

Consider the following situtations: Cade and Emma are two different persons. All the countries mentioned above are different. The country USA above is the same as the DBpedia resource http://dbpedia.org/resource/United_States (dbr:United_States) and the GeoNames resource http://sws.geonames.org/6252001/ (gn:6252001). The person class (the RDF type the Cade and Emma resources) in your graph is the same as FOAF's, schema.org's and AKT's person classes (they are http://xmlns.com/foaf/0.1/Person, http://schema.org/Person, and http://www.aktors.org/ontology/portal#Person, respectively. Nothing can be any two of a person, a university, or a city at the same time. The property you have used in your RDF/RDFS graph to represent that 94709 is the US zip code of Berkeley, California in US is a subproperty of VCard's postal code-property (http://www.w3.org/2006/vcard/ns#postal-code). No two US cities can have the same postal code. The property you have used for Emma living in Valencia is the same property as FOAF's based near-property (http://xmlns.com/foaf/0.1/based_near), and it is the inverse of DBpedia's hometown property (http://dbpedia.org/ontology/hometown, dbo:hometown). (This is not completely precise: but "hometown" is perhaps the inverse of a subproperty of "based near".)

Create a graph from this scenario using OWL triples in RDFlib.. If you can, try to build on your example from labs 2 and 3!


Look through the predicates(properties) above and make new triples for each one that describing them as any of the following: a reflexive , irreflexive, symmetric, asymmetric, or a transitive property.


Write the ontology to a TURTLE file, and try to visualise it using http://visualdataweb.de/webvowl/ . WebVOWL is oriented towards visualising classes and their properties, so the individuals may not show.

Use OntModel.writeAll() to write out the whole ontology, including OWL's built-in axioms (note that sending it to WebVOWL may not work.) Add a reasoner to your OntModel, for example ModelFactory.createOntology(OntModelSpec.OWL_MEM_RULE_INF), and writeAll() again. Can you spot any inferences?