@@ -0,0 +1,1673 @@
+package ontologyapi;%0A%0Aimport java.io.InputStream;%0A%0Aimport com.hp.hpl.jena.ontology.Individual;%0Aimport com.hp.hpl.jena.ontology.OntClass;%0Aimport com.hp.hpl.jena.ontology.OntModel;%0Aimport com.hp.hpl.jena.ontology.OntModelSpec;%0Aimport com.hp.hpl.jena.ontology.OntResource;%0Aimport com.hp.hpl.jena.rdf.model.ModelFactory;%0Aimport com.hp.hpl.jena.util.FileManager;%0Aimport com.hp.hpl.jena.util.iterator.ExtendedIterator;%0A%0A/**%0A * Task 07: Querying ontologies (RDFs)%0A * @author elozano%0A *%0A */%0Apublic class cesoriano_Task07%0A%7B%0A%09public static String ns = %22http://somewhere#%22;%0A%09%0A%09public static void main(String args%5B%5D)%0A%09%7B%0A%09%09String filename = %22example6.rdf%22;%0A%09%09%0A%09%09// Create an empty model%0A%09%09OntModel model = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM);%0A%09%09%0A%09%09// Use the FileManager to find the input file%0A%09%09InputStream in = FileManager.get().open(filename);%0A%09%0A%09%09if (in == null)%0A%09%09%09throw new IllegalArgumentException(%22File: %22+filename+%22 not found%22);%0A%09%0A%09%09// Read the RDF/XML file%0A%09%09model.read(in, null);%0A%09%09%0A%09%09%0A%09%09// ** TASK 7.1: List all individuals of %22Person%22 **%0A%09%09OntClass person = model.getOntClass(ns+%22Person%22);%0A%09%09ExtendedIterator%3CIndividual%3E personIter = model.listIndividuals(person); %0A%0A%09        while (personIter.hasNext()) %7B%0A%09            System.out.println(personIter.next());%0A%09        %7D%0A%09%09%0A%09%09// ** TASK 7.2: List all subclasses of %22Person%22 **%0A%09        ExtendedIterator%3COntClass%3E personIt = person.listSubClasses();%0A%09        %0A%09        while (personIt.hasNext()) %7B%0A%09            System.out.println(personIt.next());%0A%09        %7D%0A%09%09%0A%09%09%0A%09%09// ** TASK 7.3: Make the necessary changes to get as well indirect instances and subclasses. TIP: you need some inference... **%0A%09%09%0A%09%0A%09%7D%0A%7D%0A

Create cesoriano_Task07.java