Difference between revisions of "Lab: RDFS Programming in Jena"

From Info216
Line 13: Line 13:
  
 
==Tasks==
 
==Tasks==
"Draw an RDFS graph on paper for (as much as you can of) the following extensions to the task from lab 2:
+
Draw an RDFS graph on paper for (as much as you can of) the following extensions to the task from lab 2:
University of California, Berkeley and University of Valencia are both Universities.
+
"University of California, Berkeley and University of Valencia are both Universities.
 
All universities are higher education instituttions (HEIs). Having a B.Sc. from a HEI and having a M.Sc.
 
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. Only persons can graduate from a HEI. That a person has a degree in a subject means
 
from a HEI are special cases of gradutating from that HEI. Only persons can graduate from a HEI. That a person has a degree in a subject means
Line 33: Line 33:
 
Rewrite some of your existing code to use rdfs:label in a triple and add an rdfs:comment to the same resource.
 
Rewrite some of your existing code to use rdfs:label in a triple and add an rdfs:comment to the same resource.
  
Create a new RDFS graph that wraps an empty base (or raw) model. This graph contains only RDFS axioms. Write it out in Turtle and read through them.
+
Create a new RDFS graph that wraps an empty base (or raw) model. This graph contains only RDFS axioms. Write it out in Turtle and check that you understand  their meaning and purpose.
  
 
==If you have more time...==
 
==If you have more time...==

Revision as of 16:48, 27 January 2017

Lab 3: RDFS Programming in Jena

Topics

Draw RDFS graphs on paper. Basic RDFS graph programming in Jena. Entailments and axioms.

Classes/interfaces

Model (createRDFSModel) InfModel (getRawModel, remove + the same methods as Model) RDFS (label, comment, subClassOf, subPropertyOf, domain, range)

Tasks

Draw an RDFS graph on paper for (as much as you can of) the following extensions to the task from lab 2: "University of California, Berkeley and University of Valencia are both Universities. 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. Only persons can graduate from a 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 in is always a subject."

Create and output the RDFS graph in Jena (as an InfModel that wraps a default Model) - if you can, try to build on your example from lab 2!

Check that simple inference works - make sure that your graph contains triples like these, even if you have not asserted them explicitly:

  • that UCB and UV are HEIs
  • that Cade and Ines have both graduated from some HEI
  • that Cade and Ines both have expertises
  • that Cade and Ines are both persons
  • that biology and chemistry are both subjects

Rewrite some of your existing code to use rdfs:label in a triple and add an rdfs:comment to the same resource.

Create a new RDFS graph that wraps an empty base (or raw) model. This graph contains only RDFS axioms. Write it out in Turtle and check that you understand their meaning and purpose.

If you have more time...

Get the base (or raw) model from a new RDFS graph (InfModel) and write it out (to check that it is empty). Write out the RDFS graph itself to see the axioms it contains.

Add some triple to the new RDFS graph. Get the base (or raw model) again and write it out to see where the new triple went.

Download the FOAF vocabulary from http://xmlns.com/foaf/spec/index.rdf and save it to a file called, e.g., FOAF.rdf . Use the schemagen tool (it is inside your Jena folders) to generate a Java class for the FOAF vocabulary.

Include the FOAF.java file into your project and try to use FOAF classes and properties where they fit. Try to relate the other classes and properties you have used to the classes and properties in FOAF.