From: <jen...@us...> - 2008-02-10 17:52:44
|
Revision: 535 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=535&view=rev Author: jenslehmann Date: 2008-02-10 09:52:40 -0800 (Sun, 10 Feb 2008) Log Message: ----------- started Prolog to OWL mapping for carcinogenesis data Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/dl/KB.java trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/examples/PokerTransformer.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/utilities/Files.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/examples/PokerCard.java trunk/src/dl-learner/org/dllearner/examples/PokerHand.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/examples/Card.java trunk/src/dl-learner/org/dllearner/examples/Hand.java Modified: trunk/src/dl-learner/org/dllearner/core/dl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/KB.java 2008-02-10 16:08:51 UTC (rev 534) +++ trunk/src/dl-learner/org/dllearner/core/dl/KB.java 2008-02-10 17:52:40 UTC (rev 535) @@ -134,6 +134,24 @@ return tbox; } + /** + * Convenience method, which adds an axiom to ABox, RBox, or + * TBox depending on whether it is an assertional, role, or + * terminological axiom. + * + * @param axiom Axiom to add. + */ + public void addAxiom(Axiom axiom) { + if(axiom instanceof AssertionalAxiom) + addABoxAxiom((AssertionalAxiom) axiom); + else if(axiom instanceof RBoxAxiom) + addRBoxAxiom((RBoxAxiom) axiom); + else if(axiom instanceof TerminologicalAxiom) + addTBoxAxiom((TerminologicalAxiom) axiom); + else + throw new Error(axiom + " has unsupported axiom type."); + } + public void addABoxAxiom(AssertionalAxiom axiom) { abox.add(axiom); } Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-10 16:08:51 UTC (rev 534) +++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-10 17:52:40 UTC (rev 535) @@ -22,11 +22,25 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import org.dllearner.core.dl.AtomicConcept; +import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.Axiom; +import org.dllearner.core.dl.Individual; +import org.dllearner.core.dl.KB; +import org.dllearner.core.dl.RoleAssertion; import org.dllearner.parser.ParseException; import org.dllearner.parser.PrologParser; +import org.dllearner.prolog.Atom; +import org.dllearner.prolog.Clause; import org.dllearner.prolog.Program; +import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.utilities.Files; +import org.dllearner.utilities.Helper; /** * This class maps the carcinogenesis Prolog files to an OWL file. In a first @@ -34,23 +48,60 @@ * applying mapping Prolog clauses to OWL axioms through domain specific mapping * rules. * + * The carcinogenesis Prolog files are available here: + * http://web.comlab.ox.ac.uk/oucl/research/areas/machlearn/cancer.html + * + * .f files contain positive and .n files contain negative examples. pte1.n and + * pte.f contain the PTE-1 challenge examples. train.n and train.f contain other + * examples which can be used to train for PTE-1. + * + * The PTE-2 directory contains PTE-2 files, i.e. all substances referred to in + * those files are only those of the PTE-2 challenge. + * * @author Jens Lehmann * */ public class Carcinogenesis { + private static URI ontologyURI = URI.create("http://dl-learner.org/carcinogenesis"); + /** * @param args + * No arguments supported. */ public static void main(String[] args) { + String prologDirectory = "examples/carcinogenesis/prolog/"; + String[] files = new String[] { "ames.pl", "atoms.pl", "bonds.pl", "gentoxprops.pl", + "ind_nos.pl", "ind_pos.pl", "newgroups.pl", + // "train.b" => not a pure Prolog file but Progol/Aleph specific + }; + File owlFile = new File("examples/carcinogenesis/pte.owl"); + + Program program = null; + long startTime, duration; + String time; + try { - String prologFile = "examples/carcinogenesis/prolog/atoms.pl"; - File file = new File(prologFile); - String content = Files.readFile(file); + // reading files + System.out.print("Reading in carcinogenesis Prolog files ... "); + startTime = System.nanoTime(); + String content = ""; + for (String file : files) { + content += Files.readFile(new File(prologDirectory + file)); + } + duration = System.nanoTime() - startTime; + time = Helper.prettyPrintNanoSeconds(duration, false, false); + System.out.println("OK (" + time + ")."); + + // parsing files + System.out.print("Parsing Prolog files ... "); + startTime = System.nanoTime(); PrologParser pp = new PrologParser(); - Program program = pp.parseProgram(content); - System.out.println(program.toPLString()); + program = pp.parseProgram(content); + duration = System.nanoTime() - startTime; + time = Helper.prettyPrintNanoSeconds(duration, false, false); + System.out.println("OK (" + time + ")."); } catch (ParseException e) { e.printStackTrace(); } catch (FileNotFoundException e) { @@ -59,6 +110,66 @@ e.printStackTrace(); } + // mapping clauses to axioms + System.out.print("Mapping clauses to axioms ... "); + startTime = System.nanoTime(); + ArrayList<Clause> clauses = program.getClauses(); + KB kb = new KB(); + for (Clause clause : clauses) { + List<Axiom> axioms = mapClause(clause); + for (Axiom axiom : axioms) + kb.addAxiom(axiom); + } + duration = System.nanoTime() - startTime; + time = Helper.prettyPrintNanoSeconds(duration, false, false); + System.out.println("OK (" + time + ")."); + + // writing generated knowledge base + System.out.print("Writing OWL file ... "); + startTime = System.nanoTime(); + OWLAPIReasoner.exportKBToOWL(owlFile, kb, ontologyURI); + duration = System.nanoTime() - startTime; + time = Helper.prettyPrintNanoSeconds(duration, false, false); + System.out.println("OK (" + time + ")."); } + private static List<Axiom> mapClause(Clause clause) { + List<Axiom> axioms = new LinkedList<Axiom>(); + Atom head = clause.getHead(); + String headName = head.getName(); + // Body body = clause.getBody(); + // ArrayList<Literal> literals = body.getLiterals(); + if (headName.equals("atm")) { + // System.out.println(clause.toPLString()); + // System.out.println(clause); + String compoundName = head.getArgument(0).toPLString(); + String atomName = head.getArgument(1).toPLString(); + RoleAssertion ra = getRoleAssertion("hasAtom", compoundName, atomName); + axioms.add(ra); + } else { + + } + return axioms; + } + + private static RoleAssertion getRoleAssertion(String role, String i1, String i2) { + Individual ind1 = getIndividual(i1); + Individual ind2 = getIndividual(i2); + AtomicRole ar = getRole(role); + return new RoleAssertion(ar,ind1,ind2); + } + + private static Individual getIndividual(String name) { + return new Individual(ontologyURI + "#" + name); + } + + private static AtomicRole getRole(String name) { + return new AtomicRole(ontologyURI + "#" + name); + } + + @SuppressWarnings({"unused"}) + private static AtomicConcept getAtomicConcept(String name) { + return new AtomicConcept(ontologyURI + "#" + name); + } + } Deleted: trunk/src/dl-learner/org/dllearner/examples/Card.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Card.java 2008-02-10 16:08:51 UTC (rev 534) +++ trunk/src/dl-learner/org/dllearner/examples/Card.java 2008-02-10 17:52:40 UTC (rev 535) @@ -1,71 +0,0 @@ -package org.dllearner.examples; - -public class Card { - - private int suit; - private int rank; - - /** - * - * @param suit Ordinal (1-4) representing {Hearts, Spades, Diamonds, Clubs}. - * @param rank Numerical (1-13) representing (Ace, 2, 3, ... , Queen, King) - */ - public Card(int suit, int rank) { - this.suit = suit; - this.rank = rank; - } - - public String getSuitString() { - switch(suit) { - case 1: return "hearts"; - case 2: return "spades"; - case 3: return "diamonds"; - case 4: return "clubs"; - } - throw new Error("Unknown suit code " + suit); - } - - public String getRankString() { - switch(rank) { - case 1: return "ace"; - case 2: return "two"; - case 3: return "three"; - case 4: return "four"; - case 5: return "five"; - case 6: return "six"; - case 7: return "seven"; - case 8: return "eight"; - case 9: return "nine"; - case 10: return "ten"; - case 11: return "jack"; - case 12: return "queen"; - case 13: return "king"; - } - throw new Error("Unknown rank code " + rank); - } - - public boolean hasSameSuit(Card card) { - return (suit == card.getSuit()); - } - - public boolean hasSameRank(Card card) { - return (rank == card.getRank()); - } - - // prüft, ob übergebene Karte den nächsten Rank hat - public boolean hasNextRank(Card card) { - // Spezialfall Ass: Vorgänger von 2 und Nachfolger von König - if(rank+1 == card.getRank() || (rank==13 && card.getRank()==1)) - return true; - else - return false; - } - - public int getRank() { - return rank; - } - - public int getSuit() { - return suit; - } -} Deleted: trunk/src/dl-learner/org/dllearner/examples/Hand.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Hand.java 2008-02-10 16:08:51 UTC (rev 534) +++ trunk/src/dl-learner/org/dllearner/examples/Hand.java 2008-02-10 17:52:40 UTC (rev 535) @@ -1,38 +0,0 @@ -package org.dllearner.examples; - -public class Hand { - - private Card[] cards; - int handType; - - /** - * - * @param cards - * @param hand - * Ordinal (0-9) - * - * 0: Nothing in hand; not a recognized poker hand - * 1: One pair; one pair of equal ranks within five cards - * 2: Two pairs; two pairs of equal ranks within five cards - * 3: Three of a kind; three equal ranks within five cards - * 4: Straight; five cards, sequentially ranked with no gaps - * 5: Flush; five cards with the same suit - * 6: Full house; pair + different rank three of a kind - * 7: Four of a kind; four equal ranks within five cards - * 8: Straight flush; straight + flush - * 9: Royal flush; {Ace, King, Queen, Jack, Ten} + flush - */ - public Hand(Card[] cards, int hand) { - this.cards = cards; - this.handType = hand; - } - - public Card[] getCards() { - return cards; - } - - public int getHandType() { - return handType; - } - -} Copied: trunk/src/dl-learner/org/dllearner/examples/PokerCard.java (from rev 533, trunk/src/dl-learner/org/dllearner/examples/Card.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/PokerCard.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/examples/PokerCard.java 2008-02-10 17:52:40 UTC (rev 535) @@ -0,0 +1,76 @@ +package org.dllearner.examples; + +/** + * A poker card has one of 4 suits and 13 ranks. + * @author Jens Lehmann + * + */ +public class PokerCard { + + private int suit; + private int rank; + + /** + * + * @param suit Ordinal (1-4) representing {Hearts, Spades, Diamonds, Clubs}. + * @param rank Numerical (1-13) representing (Ace, 2, 3, ... , Queen, King) + */ + public PokerCard(int suit, int rank) { + this.suit = suit; + this.rank = rank; + } + + public String getSuitString() { + switch(suit) { + case 1: return "hearts"; + case 2: return "spades"; + case 3: return "diamonds"; + case 4: return "clubs"; + } + throw new Error("Unknown suit code " + suit); + } + + public String getRankString() { + switch(rank) { + case 1: return "ace"; + case 2: return "two"; + case 3: return "three"; + case 4: return "four"; + case 5: return "five"; + case 6: return "six"; + case 7: return "seven"; + case 8: return "eight"; + case 9: return "nine"; + case 10: return "ten"; + case 11: return "jack"; + case 12: return "queen"; + case 13: return "king"; + } + throw new Error("Unknown rank code " + rank); + } + + public boolean hasSameSuit(PokerCard card) { + return (suit == card.getSuit()); + } + + public boolean hasSameRank(PokerCard card) { + return (rank == card.getRank()); + } + + // prüft, ob übergebene Karte den nächsten Rank hat + public boolean hasNextRank(PokerCard card) { + // Spezialfall Ass: Vorgänger von 2 und Nachfolger von König + if(rank+1 == card.getRank() || (rank==13 && card.getRank()==1)) + return true; + else + return false; + } + + public int getRank() { + return rank; + } + + public int getSuit() { + return suit; + } +} Copied: trunk/src/dl-learner/org/dllearner/examples/PokerHand.java (from rev 533, trunk/src/dl-learner/org/dllearner/examples/Hand.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/PokerHand.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/examples/PokerHand.java 2008-02-10 17:52:40 UTC (rev 535) @@ -0,0 +1,44 @@ +package org.dllearner.examples; + +/** + * A poker hand consists of 5 cards. + * + * @author Jens Lehmann + * + */ +public class PokerHand { + + private PokerCard[] cards; + int handType; + + /** + * + * @param cards + * @param hand + * Ordinal (0-9) + * + * 0: Nothing in hand; not a recognized poker hand + * 1: One pair; one pair of equal ranks within five cards + * 2: Two pairs; two pairs of equal ranks within five cards + * 3: Three of a kind; three equal ranks within five cards + * 4: Straight; five cards, sequentially ranked with no gaps + * 5: Flush; five cards with the same suit + * 6: Full house; pair + different rank three of a kind + * 7: Four of a kind; four equal ranks within five cards + * 8: Straight flush; straight + flush + * 9: Royal flush; {Ace, King, Queen, Jack, Ten} + flush + */ + public PokerHand(PokerCard[] cards, int hand) { + this.cards = cards; + this.handType = hand; + } + + public PokerCard[] getCards() { + return cards; + } + + public int getHandType() { + return handType; + } + +} Modified: trunk/src/dl-learner/org/dllearner/examples/PokerTransformer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/PokerTransformer.java 2008-02-10 16:08:51 UTC (rev 534) +++ trunk/src/dl-learner/org/dllearner/examples/PokerTransformer.java 2008-02-10 17:52:40 UTC (rev 535) @@ -60,27 +60,27 @@ lineNumber++; } - List<Hand> hands = new LinkedList<Hand>(); + List<PokerHand> hands = new LinkedList<PokerHand>(); for(String s : pokerExamples) { // System.out.println(s); StringTokenizer st = new StringTokenizer(s,","); // 5 Karten einlesen - Card[] cards = new Card[5]; + PokerCard[] cards = new PokerCard[5]; for(int i=0; i<=4; i++) { String suit = st.nextToken(); String rank = st.nextToken(); - cards[i] = new Card(new Integer(suit),new Integer(rank)); + cards[i] = new PokerCard(new Integer(suit),new Integer(rank)); } // Klasse auslesen String handType = st.nextToken(); - Hand hand = new Hand(cards, new Integer(handType)); + PokerHand hand = new PokerHand(cards, new Integer(handType)); // prüfen, ob Deck schon existiert (nicht gerade effizient, // aber OK) boolean handExists = false; - for(Hand d : hands) { + for(PokerHand d : hands) { if(equalDecks(d,hand)) { handExists = true; break; @@ -112,7 +112,7 @@ // für jede Karte die entsprechende Ausgabe machen int handNumber = 0; - for(Hand deck : hands) { + for(PokerHand deck : hands) { String handID = "hand" + handNumber; // Ausgabe der Hand (damit für Reasoner klar ist, dass es @@ -120,10 +120,10 @@ write(fos, "deck("+handID+")."); int cardNumber = handNumber*5; - Card[] cards = deck.getCards(); + PokerCard[] cards = deck.getCards(); // for(Card card : deck.getCards()) { for(int i=0; i<5; i++) { - Card card = cards[i]; + PokerCard card = cards[i]; String cardID = "card" + cardNumber; // Ausgabe der Karte (damit klar ist, dass es sich um ein @@ -139,7 +139,7 @@ // sameSuit, nextRank und sameRank ausgeben for(int j=i+1; j<5; j++) { - Card otherCard = cards[j]; + PokerCard otherCard = cards[j]; String otherCardID = "card" + (handNumber*5+j); if(card.hasSameSuit(otherCard)) write(fos, "sameSuit("+cardID+","+otherCardID+")."); @@ -150,7 +150,7 @@ // nextRank ist nicht symmetrisch, deshalb müssen alle // 4 anderen Karten geprüft werden for(int j=0; j<5; j++) { - Card otherCard = cards[j]; + PokerCard otherCard = cards[j]; String otherCardID = "card" + (handNumber*5+j); if(card.hasNextRank(otherCard)) { // Spezialfall: Ass @@ -217,8 +217,8 @@ } } - public boolean equalDecks(Hand deck1, Hand deck2) { - Card[] deck1Cards = deck1.getCards(); + public boolean equalDecks(PokerHand deck1, PokerHand deck2) { + PokerCard[] deck1Cards = deck1.getCards(); for(int i=0; i<5; i++) { if(!isInCards(deck1Cards[i],deck2)) return false; @@ -226,8 +226,8 @@ return true; } - public boolean isInCards(Card card, Hand deck) { - Card[] cards = deck.getCards(); + public boolean isInCards(PokerCard card, PokerHand deck) { + PokerCard[] cards = deck.getCards(); for(int j=0; j<5; j++) { // Test auf Gleichheit if(card.getSuit()==cards[j].getSuit() && card.getRank()==cards[j].getRank()) @@ -236,8 +236,8 @@ return false; } - public boolean hasKing(Hand deck) { - Card[] cards = deck.getCards(); + public boolean hasKing(PokerHand deck) { + PokerCard[] cards = deck.getCards(); for(int j=0; j<5; j++) { if(cards[j].getRank()==13) return true; Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-10 16:08:51 UTC (rev 534) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-10 17:52:40 UTC (rev 535) @@ -19,6 +19,7 @@ */ package org.dllearner.reasoning; +import java.io.File; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; @@ -83,6 +84,9 @@ import org.semanticweb.owl.model.OWLOntologyChangeException; import org.semanticweb.owl.model.OWLOntologyCreationException; import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.OWLOntologyStorageException; +import org.semanticweb.owl.model.UnknownOWLOntologyException; +import org.semanticweb.owl.util.SimpleURIMapper; /** * Mapping to OWL API reasoner interface. The OWL API currently @@ -521,6 +525,29 @@ return new AtomicConcept(owlClass.getURI().toString()); } + public static void exportKBToOWL(File owlOutputFile, KB kb, URI ontologyURI) { + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + //URI ontologyURI = URI.create("http://example.com"); + URI physicalURI = owlOutputFile.toURI(); + SimpleURIMapper mapper = new SimpleURIMapper(ontologyURI, physicalURI); + manager.addURIMapper(mapper); + OWLOntology ontology; + try { + ontology = manager.createOntology(ontologyURI); + OWLAPIReasoner.fillOWLAPIOntology(manager, ontology, kb); + manager.saveOntology(ontology); + } catch (OWLOntologyCreationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnknownOWLOntologyException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLOntologyStorageException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + public static OWLObjectProperty getOWLAPIDescription(AtomicRole role) { return staticFactory.getOWLObjectProperty(URI.create(role.getName())); } Modified: trunk/src/dl-learner/org/dllearner/utilities/Files.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-02-10 16:08:51 UTC (rev 534) +++ trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-02-10 17:52:40 UTC (rev 535) @@ -20,13 +20,11 @@ package org.dllearner.utilities; import java.io.BufferedReader; -import java.io.DataInputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.FileReader; import java.io.IOException; -import java.io.InputStreamReader; /** * @author Jens Lehmann @@ -42,15 +40,14 @@ * @return Content of the file. */ public static String readFile(File file) throws FileNotFoundException, IOException { - FileInputStream fstream = new FileInputStream(file); - DataInputStream in = new DataInputStream(fstream); - BufferedReader br = new BufferedReader(new InputStreamReader(in)); + BufferedReader br = new BufferedReader(new FileReader(file)); String line; StringBuffer content = new StringBuffer(); while ((line = br.readLine()) != null) { content.append(line); + content.append(System.getProperty("line.separator")); } - in.close(); + br.close(); return content.toString(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-11 15:03:54
|
Revision: 539 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=539&view=rev Author: jenslehmann Date: 2008-02-11 07:03:50 -0800 (Mon, 11 Feb 2008) Log Message: ----------- - continued carcinogenesis mapper - started datatype support in DL-Learner core Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/Reasoner.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java trunk/src/dl-learner/org/dllearner/core/dl/All.java trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java trunk/src/dl-learner/org/dllearner/core/dl/Exists.java trunk/src/dl-learner/org/dllearner/core/dl/FunctionalRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/dl/GreaterEqual.java trunk/src/dl-learner/org/dllearner/core/dl/InverseRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/dl/KB.java trunk/src/dl-learner/org/dllearner/core/dl/LessEqual.java trunk/src/dl-learner/org/dllearner/core/dl/NumberRestriction.java trunk/src/dl-learner/org/dllearner/core/dl/Quantification.java trunk/src/dl-learner/org/dllearner/core/dl/RoleHierarchy.java trunk/src/dl-learner/org/dllearner/core/dl/SubRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/dl/SymmetricRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/dl/TransitiveRoleAxiom.java trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/reasoning/DIGConverter.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/utilities/ConceptTransformation.java trunk/src/dl-learner/org/dllearner/utilities/Datastructures.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java trunk/src/dl-learner/org/dllearner/utilities/RoleComparator.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/dl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/core/dl/DatatypePropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/dl/DoubleDatatypePropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/dl/ObjectProperty.java trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyExpression.java trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyInverse.java trunk/src/dl-learner/org/dllearner/core/dl/Property.java trunk/src/dl-learner/org/dllearner/core/dl/PropertyAssertion.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java trunk/src/dl-learner/org/dllearner/core/dl/InverseRole.java trunk/src/dl-learner/org/dllearner/core/dl/Role.java trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-11 15:03:50 UTC (rev 539) @@ -37,7 +37,7 @@ import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.dl.All; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Bottom; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Conjunction; @@ -251,7 +251,7 @@ // EXISTS and ALL for(Concept childNode : generatedDefinitions.get(length-2)) { - for(AtomicRole atomicRole : learningProblem.getReasoningService().getAtomicRoles()) { + for(ObjectProperty atomicRole : learningProblem.getReasoningService().getAtomicRoles()) { Concept root1 = new Exists(atomicRole,childNode); generatedDefinitions.get(length).add(root1); Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java 2008-02-11 15:03:50 UTC (rev 539) @@ -12,7 +12,7 @@ import org.dllearner.core.Score; import org.dllearner.core.dl.All; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Bottom; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Exists; @@ -439,12 +439,12 @@ name = bestNeighbours.get(3).get(nr-sizeSum2); // returnNode = new Exists(new AtomicRole(name)); // returnNode.addChild(node); - returnNode = new Exists(new AtomicRole(name),node); + returnNode = new Exists(new ObjectProperty(name),node); } else { name = bestNeighbours.get(4).get(nr-sizeSum3); // returnNode = new All(new AtomicRole(name)); // returnNode.addChild(node); - returnNode = new All(new AtomicRole(name),node); + returnNode = new All(new ObjectProperty(name),node); } return returnNode; Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java 2008-02-11 15:03:50 UTC (rev 539) @@ -11,7 +11,7 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.dl.All; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Bottom; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Exists; @@ -70,7 +70,7 @@ topSet.add(new Negation(c)); // EXISTS r.TOP und ALL r.TOP für alle r - for(AtomicRole r : reasoningService.getAtomicRoles()) { + for(ObjectProperty r : reasoningService.getAtomicRoles()) { topSet.add(new All(r, new Top())); topSet.add(new Exists(r, new Top())); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java 2008-02-11 15:03:50 UTC (rev 539) @@ -11,7 +11,7 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.dl.All; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Bottom; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Exists; @@ -58,7 +58,7 @@ bottomSet.add(new Negation(c)); // EXISTS r.BOTTOM und ALL r.BOTTOM für alle r - for(AtomicRole r : reasoningService.getAtomicRoles()) { + for(ObjectProperty r : reasoningService.getAtomicRoles()) { bottomSet.add(new All(r, new Bottom())); bottomSet.add(new Exists(r, new Bottom())); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-02-11 15:03:50 UTC (rev 539) @@ -40,7 +40,7 @@ import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Concept; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; @@ -89,12 +89,12 @@ private static String defaultSearchTreeFile = "log/searchTree.txt"; private String heuristic = "lexicographic"; Set<AtomicConcept> allowedConcepts; - Set<AtomicRole> allowedRoles; + Set<ObjectProperty> allowedRoles; Set<AtomicConcept> ignoredConcepts; - Set<AtomicRole> ignoredRoles; + Set<ObjectProperty> ignoredRoles; // these are computed as the result of the previous four settings Set<AtomicConcept> usedConcepts; - Set<AtomicRole> usedRoles; + Set<ObjectProperty> usedRoles; private boolean applyAllFilter = true; private boolean applyExistsFilter = true; private boolean useTooWeakList = true; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-02-11 15:03:50 UTC (rev 539) @@ -25,7 +25,7 @@ import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.MultiConjunction; import org.dllearner.core.dl.MultiDisjunction; @@ -51,12 +51,12 @@ private static String defaultSearchTreeFile = "log/searchTree.txt"; private Heuristic heuristic = Heuristic.LEXICOGRAPHIC; Set<AtomicConcept> allowedConcepts; - Set<AtomicRole> allowedRoles; + Set<ObjectProperty> allowedRoles; Set<AtomicConcept> ignoredConcepts; - Set<AtomicRole> ignoredRoles; + Set<ObjectProperty> ignoredRoles; // these are computed as the result of the previous four settings Set<AtomicConcept> usedConcepts; - Set<AtomicRole> usedRoles; + Set<ObjectProperty> usedRoles; private boolean applyAllFilter = true; private boolean applyExistsFilter = true; private boolean useTooWeakList = true; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java 2008-02-11 15:03:50 UTC (rev 539) @@ -32,7 +32,7 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.dl.All; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Bottom; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Conjunction; @@ -42,7 +42,7 @@ import org.dllearner.core.dl.MultiDisjunction; import org.dllearner.core.dl.Negation; import org.dllearner.core.dl.Quantification; -import org.dllearner.core.dl.Role; +import org.dllearner.core.dl.ObjectPropertyExpression; import org.dllearner.core.dl.Top; import org.dllearner.utilities.ConceptComparator; import org.dllearner.utilities.ConceptTransformation; @@ -264,7 +264,7 @@ } } else if (concept instanceof Exists) { - Role role = ((Quantification)concept).getRole(); + ObjectPropertyExpression role = ((Quantification)concept).getRole(); // rule 1: EXISTS r.D => EXISTS r.E tmp = refine(concept.getChild(0), maxLength-2, null); @@ -275,14 +275,14 @@ // rule 2: EXISTS r.D => EXISTS s.D or EXISTS r^-1.D => EXISTS s^-1.D // currently inverse roles are not supported - AtomicRole ar = (AtomicRole) role; - Set<AtomicRole> moreSpecialRoles = rs.getMoreSpecialRoles(ar); - for(AtomicRole moreSpecialRole : moreSpecialRoles) { + ObjectProperty ar = (ObjectProperty) role; + Set<ObjectProperty> moreSpecialRoles = rs.getMoreSpecialRoles(ar); + for(ObjectProperty moreSpecialRole : moreSpecialRoles) { refinements.add(new Exists(moreSpecialRole, concept.getChild(0))); } } else if (concept instanceof All) { - Role role = ((Quantification)concept).getRole(); + ObjectPropertyExpression role = ((Quantification)concept).getRole(); // rule 1: ALL r.D => ALL r.E tmp = refine(concept.getChild(0), maxLength-2, null); @@ -302,9 +302,9 @@ // rule 3: ALL r.D => ALL s.D or ALL r^-1.D => ALL s^-1.D // currently inverse roles are not supported - AtomicRole ar = (AtomicRole) role; - Set<AtomicRole> moreSpecialRoles = rs.getMoreSpecialRoles(ar); - for(AtomicRole moreSpecialRole : moreSpecialRoles) { + ObjectProperty ar = (ObjectProperty) role; + Set<ObjectProperty> moreSpecialRoles = rs.getMoreSpecialRoles(ar); + for(ObjectProperty moreSpecialRole : moreSpecialRoles) { refinements.add(new All(moreSpecialRole, concept.getChild(0))); } @@ -334,8 +334,8 @@ if(c instanceof All) { for(Concept child : concept.getChildren()) { if(child instanceof All) { - Role r1 = ((All)c).getRole(); - Role r2 = ((All)child).getRole(); + ObjectPropertyExpression r1 = ((All)c).getRole(); + ObjectPropertyExpression r2 = ((All)child).getRole(); if(r1.toString().equals(r2.toString())) skip = true; } @@ -543,7 +543,7 @@ // m3.add(new Exists(r, new Top())); //} // new operator: only uses most general roles - for(AtomicRole r : rs.getMostGeneralRoles()) { + for(ObjectProperty r : rs.getMostGeneralRoles()) { m3.add(new Exists(r, new Top())); } m.put(3,m3); @@ -573,7 +573,7 @@ // m.get(i+2).add(new All(r,c)); // } - for(AtomicRole r : rs.getMostGeneralRoles()) { + for(ObjectProperty r : rs.getMostGeneralRoles()) { m.get(i+2).add(new All(r,c)); } } Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-11 15:03:50 UTC (rev 539) @@ -62,7 +62,7 @@ import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.config.StringTupleListConfigOption; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Individual; import org.dllearner.kb.KBFile; @@ -504,7 +504,7 @@ int stringLength = rs.getAtomicRoles().toString().length(); if (stringLength > maxLineLength) { System.out.println("roles[" + rs.getAtomicRoles().size() + "]: "); - for (AtomicRole r : rs.getAtomicRoles()) + for (ObjectProperty r : rs.getAtomicRoles()) System.out.println(" " + r); } else System.out.println("roles[" + rs.getAtomicRoles().size() + "]: " @@ -647,7 +647,7 @@ SortedSet<AtomicConcept> occurringConcepts = new TreeSet<AtomicConcept>( new ConceptComparator()); occurringConcepts.addAll(Helper.getAtomicConcepts(concept)); - SortedSet<AtomicRole> occurringRoles = new TreeSet<AtomicRole>( + SortedSet<ObjectProperty> occurringRoles = new TreeSet<ObjectProperty>( new RoleComparator()); occurringRoles.addAll(Helper.getAtomicRoles(concept)); @@ -662,7 +662,7 @@ // is used) for (AtomicConcept ac : rs.getAtomicConcepts()) occurringConcepts.remove(ac); - for (AtomicRole ar : rs.getAtomicRoles()) + for (ObjectProperty ar : rs.getAtomicRoles()) occurringRoles.remove(ar); boolean nonExistingConstructs = false; Modified: trunk/src/dl-learner/org/dllearner/core/Reasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Reasoner.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/Reasoner.java 2008-02-11 15:03:50 UTC (rev 539) @@ -25,7 +25,7 @@ import java.util.SortedSet; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Individual; import org.dllearner.core.dl.RoleHierarchy; @@ -48,7 +48,7 @@ // => erstellt auch vereinfachte Sichten auf Subsumptionhierarchie // (siehe einfacher Traversal in Diplomarbeit) public void prepareSubsumptionHierarchy(Set<AtomicConcept> allowedConcepts); - public void prepareRoleHierarchy(Set<AtomicRole> allowedRoles) throws ReasoningMethodUnsupportedException; + public void prepareRoleHierarchy(Set<ObjectProperty> allowedRoles) throws ReasoningMethodUnsupportedException; public boolean subsumes(Concept superConcept, Concept subConcept) throws ReasoningMethodUnsupportedException; @@ -68,7 +68,7 @@ public SortedSet<Individual> retrieval(Concept concept) throws ReasoningMethodUnsupportedException; - public Map<Individual, SortedSet<Individual>> getRoleMembers(AtomicRole atomicRole) throws ReasoningMethodUnsupportedException; + public Map<Individual, SortedSet<Individual>> getRoleMembers(ObjectProperty atomicRole) throws ReasoningMethodUnsupportedException; public boolean instanceCheck(Concept concept, Individual individual) throws ReasoningMethodUnsupportedException; @@ -86,7 +86,7 @@ public Set<AtomicConcept> getAtomicConcepts(); - public Set<AtomicRole> getAtomicRoles(); + public Set<ObjectProperty> getAtomicRoles(); public SortedSet<Individual> getIndividuals(); } Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-02-11 15:03:50 UTC (rev 539) @@ -26,7 +26,7 @@ import java.util.TreeSet; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Individual; import org.dllearner.core.dl.RoleHierarchy; @@ -69,7 +69,7 @@ throw new ReasoningMethodUnsupportedException(); } - public Map<Individual, SortedSet<Individual>> getRoleMembers(AtomicRole atomicRole) + public Map<Individual, SortedSet<Individual>> getRoleMembers(ObjectProperty atomicRole) throws ReasoningMethodUnsupportedException { throw new ReasoningMethodUnsupportedException(); } @@ -108,7 +108,7 @@ throw new ReasoningMethodUnsupportedException(); } - public void prepareRoleHierarchy(Set<AtomicRole> allowedRoles) throws ReasoningMethodUnsupportedException { + public void prepareRoleHierarchy(Set<ObjectProperty> allowedRoles) throws ReasoningMethodUnsupportedException { throw new ReasoningMethodUnsupportedException(); } Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-02-11 15:03:50 UTC (rev 539) @@ -28,7 +28,7 @@ import java.util.TreeSet; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Individual; import org.dllearner.core.dl.RoleHierarchy; @@ -73,7 +73,7 @@ // Listenansicht private List<AtomicConcept> atomicConceptsList; - private List<AtomicRole> atomicRolesList; + private List<ObjectProperty> atomicRolesList; // private SortedSet<Concept> retrievalsSet = new TreeSet<Concept>(new ConceptComparator()); @@ -291,22 +291,22 @@ /** * Returns more general concepts in the subsumption hierarchy. * - * @see RoleHierarchy#getMoreGeneralRoles(AtomicRole) + * @see RoleHierarchy#getMoreGeneralRoles(ObjectProperty) * @param role Atomic concept, top, or bottom. * @return A set of more general concepts. */ - public SortedSet<AtomicRole> getMoreGeneralRoles(AtomicRole role) { + public SortedSet<ObjectProperty> getMoreGeneralRoles(ObjectProperty role) { return getRoleHierarchy().getMoreGeneralRoles(role); } /** * Returns more special concepts in the subsumption hierarchy. * - * @see RoleHierarchy#getMoreSpecialRoles(AtomicRole) + * @see RoleHierarchy#getMoreSpecialRoles(ObjectProperty) * @param role Atomic concept, top, or bottom. * @return A set of more special concepts. */ - public SortedSet<AtomicRole> getMoreSpecialRoles(AtomicRole role) { + public SortedSet<ObjectProperty> getMoreSpecialRoles(ObjectProperty role) { return getRoleHierarchy().getMoreSpecialRoles(role); } @@ -314,7 +314,7 @@ * @see RoleHierarchy#getMostGeneralRoles() * @return The most general roles. */ - public TreeSet<AtomicRole> getMostGeneralRoles() { + public TreeSet<ObjectProperty> getMostGeneralRoles() { return getRoleHierarchy().getMostGeneralRoles(); } @@ -322,7 +322,7 @@ * @see RoleHierarchy#getMostSpecialRoles() * @return The most special roles. */ - public TreeSet<AtomicRole> getMostSpecialRoles() { + public TreeSet<ObjectProperty> getMostSpecialRoles() { return getRoleHierarchy().getMostSpecialRoles(); } @@ -348,7 +348,7 @@ prepareRoleHierarchy(getAtomicRoles()); } - public void prepareRoleHierarchy(Set<AtomicRole> allowedRoles) { + public void prepareRoleHierarchy(Set<ObjectProperty> allowedRoles) { try { reasoner.prepareRoleHierarchy(allowedRoles); } catch (ReasoningMethodUnsupportedException e) { @@ -382,7 +382,7 @@ // gibt zu einer Rolle alle Elemente zur�ck // private, da es keine Standardoperation ist - public Map<Individual, SortedSet<Individual>> getRoleMembers(AtomicRole atomicRole) { + public Map<Individual, SortedSet<Individual>> getRoleMembers(ObjectProperty atomicRole) { reasoningStartTimeTmp = System.nanoTime(); Map<Individual, SortedSet<Individual>> result; try { @@ -401,7 +401,7 @@ return reasoner.getAtomicConcepts(); } - public Set<AtomicRole> getAtomicRoles() { + public Set<ObjectProperty> getAtomicRoles() { return reasoner.getAtomicRoles(); } @@ -419,9 +419,9 @@ return atomicConceptsList; } - public List<AtomicRole> getAtomicRolesList() { + public List<ObjectProperty> getAtomicRolesList() { if(atomicRolesList == null) - atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); + atomicRolesList = new LinkedList<ObjectProperty>(getAtomicRoles()); return atomicRolesList; } Modified: trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java 2008-02-11 15:03:50 UTC (rev 539) @@ -24,7 +24,7 @@ import java.util.TreeSet; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; +import org.dllearner.core.dl.ObjectProperty; import org.dllearner.core.dl.Individual; import org.dllearner.utilities.ConceptComparator; @@ -51,10 +51,10 @@ return set; } - public static SortedSet<AtomicRole> getAtomicRoleSet(Set<String> atomicRoles) { - SortedSet<AtomicRole> set = new TreeSet<AtomicRole>(); + public static SortedSet<ObjectProperty> getAtomicRoleSet(Set<String> atomicRoles) { + SortedSet<ObjectProperty> set = new TreeSet<ObjectProperty>(); for(String atomicRole : atomicRoles) - set.add(new AtomicRole(atomicRole)); + set.add(new ObjectProperty(atomicRole)); return set; } } Modified: trunk/src/dl-learner/org/dllearner/core/dl/All.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/All.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/All.java 2008-02-11 15:03:50 UTC (rev 539) @@ -5,7 +5,7 @@ public class All extends Quantification { - public All(Role role, Concept c) { + public All(ObjectPropertyExpression role, Concept c) { super(role, c); } Deleted: trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java 2008-02-11 15:03:50 UTC (rev 539) @@ -1,51 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.core.dl; - -import java.util.Map; - -import org.dllearner.utilities.Helper; - -/** - * Represents an atomic concept in a knowledge base / ontology, - * e.g. "hasChild". - * - * @author Jens Lehmann - * - */ -public class AtomicRole extends Role { - - public AtomicRole(String name) { - super(name); - } - - public int getLength() { - return 1; - } - - @Override - public String toString() { - return name; - } - - public String toString(String baseURI, Map<String,String> prefixes) { - return Helper.getAbbreviatedString(name, baseURI, prefixes); - } -} Modified: trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java 2008-02-11 15:03:50 UTC (rev 539) @@ -22,7 +22,7 @@ import java.util.Map; /** - * Represents an concept assertion in a knowledge base / ontology, + * Represents a concept assertion in a knowledge base / ontology, * e.g. "heiko is a person", "heiko is a male person having one child". * * @author Jens Lehmann Added: trunk/src/dl-learner/org/dllearner/core/dl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/DatatypeProperty.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/DatatypeProperty.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +import java.util.Map; + +import org.dllearner.utilities.Helper; + +/** + * @author Jens Lehmann + * + */ +public class DatatypeProperty implements Property { + + protected String name; + + public DatatypeProperty(String name) { + this.name=name; + } + + /* (non-Javadoc) + * @see org.dllearner.core.dl.KBElement#getLength() + */ + public int getLength() { + return 1; + } + + /* (non-Javadoc) + * @see org.dllearner.core.dl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + return Helper.getAbbreviatedString(name, baseURI, prefixes); + } + +} Added: trunk/src/dl-learner/org/dllearner/core/dl/DatatypePropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/DatatypePropertyAssertion.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/DatatypePropertyAssertion.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +/** + * A datatype property assertion. + * + * @author Jens Lehmann + * + */ +public abstract class DatatypePropertyAssertion extends PropertyAssertion { + + protected DatatypeProperty datatypeProperty; + protected Individual individual; + + public DatatypePropertyAssertion(DatatypeProperty datatypeProperty, Individual individual) { + this.datatypeProperty = datatypeProperty; + this.individual = individual; + } + + /* (non-Javadoc) + * @see org.dllearner.core.dl.KBElement#getLength() + */ + public int getLength() { + return 3; + } + + /** + * @return the individual + */ + public Individual getIndividual() { + return individual; + } + + /** + * @return the datatypeProperty + */ + public DatatypeProperty getDatatypeProperty() { + return datatypeProperty; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/dl/DoubleDatatypePropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/DoubleDatatypePropertyAssertion.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/DoubleDatatypePropertyAssertion.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class DoubleDatatypePropertyAssertion extends DatatypePropertyAssertion { + + private double value; + + public DoubleDatatypePropertyAssertion(DatatypeProperty datatypeProperty, Individual individual, double value) { + super(datatypeProperty, individual); + this.value = value; + } + + + + /* (non-Javadoc) + * @see org.dllearner.core.dl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + return datatypeProperty.toString(baseURI, prefixes) + "(" + individual.toString(baseURI, prefixes) + "," + value +")"; + } + + public double getValue() { + return value; + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/dl/Exists.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Exists.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/Exists.java 2008-02-11 15:03:50 UTC (rev 539) @@ -5,7 +5,7 @@ public class Exists extends Quantification { - public Exists(Role role, Concept c) { + public Exists(ObjectPropertyExpression role, Concept c) { super(role,c); } Modified: trunk/src/dl-learner/org/dllearner/core/dl/FunctionalRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/FunctionalRoleAxiom.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/FunctionalRoleAxiom.java 2008-02-11 15:03:50 UTC (rev 539) @@ -4,13 +4,13 @@ public class FunctionalRoleAxiom extends RBoxAxiom { - private AtomicRole role; + private ObjectProperty role; - public FunctionalRoleAxiom(AtomicRole role) { + public FunctionalRoleAxiom(ObjectProperty role) { this.role = role; } - public Role getRole() { + public ObjectPropertyExpression getRole() { return role; } Modified: trunk/src/dl-learner/org/dllearner/core/dl/GreaterEqual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/GreaterEqual.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/GreaterEqual.java 2008-02-11 15:03:50 UTC (rev 539) @@ -4,7 +4,7 @@ public class GreaterEqual extends NumberRestriction { - public GreaterEqual(int number, Role role, Concept c) { + public GreaterEqual(int number, ObjectPropertyExpression role, Concept c) { super(number,role,c); } Deleted: trunk/src/dl-learner/org/dllearner/core/dl/InverseRole.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/InverseRole.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/InverseRole.java 2008-02-11 15:03:50 UTC (rev 539) @@ -1,46 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.core.dl; - -import java.util.Map; - -import org.dllearner.utilities.Helper; - -/** - * An inverse role. - * - * @author Jens Lehmann - * - */ -public class InverseRole extends Role { - - public InverseRole(String name) { - super(name); - } - - public int getLength() { - return 2; - } - - public String toString(String baseURI, Map<String,String> prefixes) { - return Helper.getAbbreviatedString(name, baseURI, prefixes) + "-"; - } -} Modified: trunk/src/dl-learner/org/dllearner/core/dl/InverseRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/InverseRoleAxiom.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/InverseRoleAxiom.java 2008-02-11 15:03:50 UTC (rev 539) @@ -4,19 +4,19 @@ public class InverseRoleAxiom extends RBoxAxiom { - private AtomicRole inverseRole; - private AtomicRole role; + private ObjectProperty inverseRole; + private ObjectProperty role; - public InverseRoleAxiom(AtomicRole inverseRole, AtomicRole role) { + public InverseRoleAxiom(ObjectProperty inverseRole, ObjectProperty role) { this.inverseRole = inverseRole; this.role = role; } - public AtomicRole getInverseRole() { + public ObjectProperty getInverseRole() { return inverseRole; } - public AtomicRole getRole() { + public ObjectProperty getRole() { return role; } Modified: trunk/src/dl-learner/org/dllearner/core/dl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/KB.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/KB.java 2008-02-11 15:03:50 UTC (rev 539) @@ -16,9 +16,9 @@ SortedSet<Individual> individuals = new TreeSet<Individual>(); for(Axiom axiom : abox) { - if(axiom instanceof RoleAssertion) { - individuals.add(((RoleAssertion)axiom).getIndividual1()); - individuals.add(((RoleAssertion)axiom).getIndividual2()); + if(axiom instanceof ObjectPropertyAssertion) { + individuals.add(((ObjectPropertyAssertion)axiom).getIndividual1()); + individuals.add(((ObjectPropertyAssertion)axiom).getIndividual2()); } else if(axiom instanceof ConceptAssertion) { individuals.add(((ConceptAssertion)axiom).getIndividual()); } @@ -27,12 +27,12 @@ return individuals; } - public Set<AtomicRole> findAllAtomicRoles() { + public Set<ObjectProperty> findAllAtomicRoles() { Set<String> roleNames = new HashSet<String>(); for(Axiom axiom : abox) { - if(axiom instanceof RoleAssertion) - roleNames.add(((RoleAssertion)axiom).getRole().getName()); + if(axiom instanceof ObjectPropertyAssertion) + roleNames.add(((ObjectPropertyAssertion)axiom).getRole().getName()); } for(Axiom axiom : tbox) { @@ -61,9 +61,9 @@ } } - Set<AtomicRole> ret = new HashSet<AtomicRole>(); + Set<ObjectProperty> ret = new HashSet<ObjectProperty>(); for(String name : roleNames) { - ret.add(new AtomicRole(name)); + ret.add(new ObjectProperty(name)); } return ret; } @@ -202,8 +202,8 @@ // alle direkt mit diesem Individual verbundenen Individuals finden TreeSet<Individual> connectedSet = new TreeSet<Individual>(); for(AssertionalAxiom axiom : abox) { - if(axiom instanceof RoleAssertion) { - RoleAssertion ra = (RoleAssertion)axiom; + if(axiom instanceof ObjectPropertyAssertion) { + ObjectPropertyAssertion ra = (ObjectPropertyAssertion)axiom; if(ra.getIndividual1().equals(individual)) connectedSet.add(ra.getIndividual2()); } Modified: trunk/src/dl-learner/org/dllearner/core/dl/LessEqual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/LessEqual.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/LessEqual.java 2008-02-11 15:03:50 UTC (rev 539) @@ -4,7 +4,7 @@ public class LessEqual extends NumberRestriction { - public LessEqual(int number, Role role, Concept c) { + public LessEqual(int number, ObjectPropertyExpression role, Concept c) { super(number,role,c); } Modified: trunk/src/dl-learner/org/dllearner/core/dl/NumberRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/NumberRestriction.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/NumberRestriction.java 2008-02-11 15:03:50 UTC (rev 539) @@ -2,10 +2,10 @@ public abstract class NumberRestriction extends Concept { - protected Role role; + protected ObjectPropertyExpression role; protected int number; - public NumberRestriction(int number, Role role, Concept c) { + public NumberRestriction(int number, ObjectPropertyExpression role, Concept c) { addChild(c); this.role = role; this.number = number; @@ -19,7 +19,7 @@ return number; } - public Role getRole() { + public ObjectPropertyExpression getRole() { return role; } Copied: trunk/src/dl-learner/org/dllearner/core/dl/ObjectProperty.java (from rev 535, trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectProperty.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/ObjectProperty.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +import java.util.Map; + +import org.dllearner.utilities.Helper; + +/** + * Represents an object property in a knowledge base / ontology, + * e.g. "hasChild". + * + * @author Jens Lehmann + * + */ +public class ObjectProperty extends ObjectPropertyExpression implements Property { + + public ObjectProperty(String name) { + super(name); + } + + public int getLength() { + return 1; + } + + @Override + public String toString() { + return name; + } + + public String toString(String baseURI, Map<String,String> prefixes) { + return Helper.getAbbreviatedString(name, baseURI, prefixes); + } +} Copied: trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyAssertion.java (from rev 535, trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyAssertion.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyAssertion.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,62 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +import java.util.Map; + +/** + * Represents an role assertion in a knowledge base / ontology, + * e.g. "heiko is brother of stefan". + * + * @author Jens Lehmann + * + */ +public class ObjectPropertyAssertion extends PropertyAssertion { + + private ObjectProperty role; + private Individual individual1; + private Individual individual2; + + public ObjectPropertyAssertion(ObjectProperty role, Individual individual1, Individual individual2) { + this.role = role; + this.individual1 = individual1; + this.individual2 = individual2; + } + + public Individual getIndividual1() { + return individual1; + } + + public Individual getIndividual2() { + return individual2; + } + + public ObjectProperty getRole() { + return role; + } + + public int getLength() { + return 2 + role.getLength(); + } + + public String toString(String baseURI, Map<String,String> prefixes) { + return role.toString(baseURI, prefixes) + "(" + individual1.toString(baseURI, prefixes) + "," + individual2.toString(baseURI, prefixes) +")"; + } +} Copied: trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyExpression.java (from rev 535, trunk/src/dl-learner/org/dllearner/core/dl/Role.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyExpression.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyExpression.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +/** + * An object property expression is an object property construct, which + * can be used in axioms, e.g. complex class descriptions. It can be + * either an object property or an inverse of an object property. + * + * @author Jens Lehmann + * + */ +public abstract class ObjectPropertyExpression implements KBElement { + + protected String name; + + public ObjectPropertyExpression(String name) { + this.name = name; + } + + public String getName() { + return name; + } + +} Copied: trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyInverse.java (from rev 535, trunk/src/dl-learner/org/dllearner/core/dl/InverseRole.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyInverse.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyInverse.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.core.dl; + +import java.util.Map; + +import org.dllearner.utilities.Helper; + +/** + * Represents the inverse of a property expression. It can be used + * in axioms e.g. complex class descriptions. For instance: + * + * father = male AND isChildOf^-1 + * + * This way, you can refer to an inverse of an object property without + * actually giving it a name (you could name it isParentOf in this case). + * + * @author Jens Lehmann + * + */ +public class ObjectPropertyInverse extends ObjectPropertyExpression { + + public ObjectPropertyInverse(String name) { + super(name); + } + + public int getLength() { + return 2; + } + + public String toString(String baseURI, Map<String,String> prefixes) { + return Helper.getAbbreviatedString(name, baseURI, prefixes) + "-"; + } +} Added: trunk/src/dl-learner/org/dllearner/core/dl/Property.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Property.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/Property.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +/** + * @author Jens Lehmann + * + */ +public interface Property extends KBElement { + +} Added: trunk/src/dl-learner/org/dllearner/core/dl/PropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/PropertyAssertion.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/dl/PropertyAssertion.java 2008-02-11 15:03:50 UTC (rev 539) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.dl; + +/** + * @author Jens Lehmann + * + */ +public abstract class PropertyAssertion extends AssertionalAxiom { + +} Modified: trunk/src/dl-learner/org/dllearner/core/dl/Quantification.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Quantification.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/Quantification.java 2008-02-11 15:03:50 UTC (rev 539) @@ -2,14 +2,14 @@ public abstract class Quantification extends Concept { - Role role; + ObjectPropertyExpression role; - public Quantification(Role role, Concept c) { + public Quantification(ObjectPropertyExpression role, Concept c) { this.role = role; addChild(c); } - public Role getRole() { + public ObjectPropertyExpression getRole() { return role; } Deleted: trunk/src/dl-learner/org/dllearner/core/dl/Role.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Role.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/Role.java 2008-02-11 15:03:50 UTC (rev 539) @@ -1,15 +0,0 @@ -package org.dllearner.core.dl; - -public abstract class Role implements KBElement { - - protected String name; - - public Role(String name) { - this.name = name; - } - - public String getName() { - return name; - } - -} Deleted: trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java 2008-02-11 15:03:50 UTC (rev 539) @@ -1,62 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.core.dl; - -import java.util.Map; - -/** - * Represents an role assertion in a knowledge base / ontology, - * e.g. "heiko is brother of stefan". - * - * @author Jens Lehmann - * - */ -public class RoleAssertion extends AssertionalAxiom { - - private AtomicRole role; - private Individual individual1; - private Individual individual2; - - public RoleAssertion(AtomicRole role, Individual individual1, Individual individual2) { - this.role = role; - this.individual1 = individual1; - this.individual2 = individual2; - } - - public Individual getIndividual1() { - return individual1; - } - - public Individual getIndividual2() { - return individual2; - } - - public AtomicRole getRole() { - return role; - } - - public int getLength() { - return 2 + role.getLength(); - } - - public String toString(String baseURI, Map<String,String> prefixes) { - return role.toString(baseURI, prefixes) + "(" + individual1.toString(baseURI, prefixes) + "," + individual2.toString(baseURI, prefixes) +")"; - } -} Modified: trunk/src/dl-learner/org/dllearner/core/dl/RoleHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/RoleHierarchy.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/RoleHierarchy.java 2008-02-11 15:03:50 UTC (rev 539) @@ -38,17 +38,17 @@ public class RoleHierarchy { RoleComparator rc = new RoleComparator(); - TreeMap<AtomicRole,TreeSet<AtomicRole>> roleHierarchyUp; - TreeMap<AtomicRole,TreeSet<AtomicRole>> roleHierarchyDown; - TreeSet<AtomicRole> mostGeneralRoles = new TreeSet<AtomicRole>(rc); - TreeSet<AtomicRole> mostSpecialRoles = new TreeSet<AtomicRole>(rc); + TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyUp; + TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyDown; + TreeSet<ObjectProperty> mostGeneralRoles = new TreeSet<ObjectProperty>(rc); + TreeSet<ObjectProperty> mostSpecialRoles = new TreeSet<ObjectProperty>(rc); - public RoleHierarchy(Set<AtomicRole> atomicRoles, TreeMap<AtomicRole,TreeSet<AtomicRole>> roleHierarchyUp , TreeMap<AtomicRole,TreeSet<AtomicRole>> roleHierarchyDown) { + public RoleHierarchy(Set<ObjectProperty> atomicRoles, TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyUp , TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyDown) { this.roleHierarchyUp = roleHierarchyUp; this.roleHierarchyDown = roleHierarchyDown; // find most general and most special roles - for(AtomicRole role : atomicRoles) { + for(ObjectProperty role : atomicRoles) { if(getMoreGeneralRoles(role).size()==0) mostGeneralRoles.add(role); if(getMoreSpecialRoles(role).size()==0) @@ -57,15 +57,15 @@ } @SuppressWarnings("unchecked") - public SortedSet<AtomicRole> getMoreGeneralRoles(AtomicRole role) { + public SortedSet<ObjectProperty> getMoreGeneralRoles(ObjectProperty role) { // we clone all concepts before returning them such that they cannot be // modified externally - return (TreeSet<AtomicRole>) roleHierarchyUp.get(role).clone(); + return (TreeSet<ObjectProperty>) roleHierarchyUp.get(role).clone(); } @SuppressWarnings("unchecked") - public SortedSet<AtomicRole> getMoreSpecialRoles(AtomicRole role) { - return (TreeSet<AtomicRole>) roleHierarchyDown.get(role).clone(); + public SortedSet<ObjectProperty> getMoreSpecialRoles(ObjectProperty role) { + return (TreeSet<ObjectProperty>) roleHierarchyDown.get(role).clone(); } @@ -73,20 +73,20 @@ @Override public String toString() { String str = ""; - for(AtomicRole role : mostGeneralRoles) { + for(ObjectProperty role : mostGeneralRoles) { str += toString(roleHierarchyDown, role, 0); } return str; } - private String toString(TreeMap<AtomicRole,TreeSet<AtomicRole>> hierarchy, AtomicRole role, int depth) { + private String toString(TreeMap<ObjectProperty,TreeSet<ObjectProperty>> hierarchy, ObjectProperty role, int depth) { String str = ""; for(int i=0; i<depth; i++) str += " "; str += role.toString() + "\n"; - Set<AtomicRole> tmp = hierarchy.get(role); + Set<ObjectProperty> tmp = hierarchy.get(role); if(tmp!=null) { - for(AtomicRole c : tmp) + for(ObjectProperty c : tmp) str += toString(hierarchy, c, depth+1); } return str; @@ -95,14 +95,14 @@ /** * @return The most general roles. */ - public TreeSet<AtomicRole> getMostGeneralRoles() { + public TreeSet<ObjectProperty> getMostGeneralRoles() { return mostGeneralRoles; } /** * @return The most special roles. */ - public TreeSet<AtomicRole> getMostSpecialRoles() { + public TreeSet<ObjectProperty> getMostSpecialRoles() { return mostSpecialRoles; } Modified: trunk/src/dl-learner/org/dllearner/core/dl/SubRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/SubRoleAxiom.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/SubRoleAxiom.java 2008-02-11 15:03:50 UTC (rev 539) @@ -4,19 +4,19 @@ public class SubRoleAxiom extends RBoxAxiom { - private AtomicRole role; - private AtomicRole subRole; + private ObjectProperty role; + private ObjectProperty subRole; - public SubRoleAxiom(AtomicRole subRole, AtomicRole role) { + public SubRoleAxiom(ObjectProperty subRole, ObjectProperty role) { this.role = role; this.subRole = subRole; } - public AtomicRole getRole() { + public ObjectProperty getRole() { return role; } - public AtomicRole getSubRole() { + public ObjectProperty getSubRole() { return subRole; } Modified: trunk/src/dl-learner/org/dllearner/core/dl/SymmetricRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/SymmetricRoleAxiom.java 2008-02-11 15:00:55 UTC (rev 538) +++ trunk/src/dl-learner/org/dllearner/core/dl/SymmetricRoleAxiom.java 2008-02-11 15:03:50 UTC (rev 539) @@ -4,13 +4,13 @@ public class SymmetricRoleAxiom extends RBoxAxiom { - private AtomicRole role; + private ObjectProperty role; - public SymmetricRoleAxiom(AtomicRole role) { + public SymmetricRoleAxiom(ObjectProperty role) { this.role = role; } - public AtomicRole getRole() { + public ObjectProperty getRole() { return role; } Modified: trunk/src/dl-learner/org/dllearner/core/dl/Transit... [truncated message content] |
From: <jen...@us...> - 2008-02-11 15:24:08
|
Revision: 540 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=540&view=rev Author: jenslehmann Date: 2008-02-11 07:24:02 -0800 (Mon, 11 Feb 2008) Log Message: ----------- small fixes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/parser/ConfParser.java trunk/src/dl-learner/org/dllearner/parser/KBParser.java trunk/src/dl-learner/org/dllearner/parser/conf.jj trunk/src/dl-learner/org/dllearner/parser/kb.jj Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-02-11 15:03:50 UTC (rev 539) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-02-11 15:24:02 UTC (rev 540) @@ -43,8 +43,8 @@ import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; import org.dllearner.core.dl.Individual; +import org.dllearner.core.dl.ObjectProperty; /** * WidgetPanelStringSet @@ -244,11 +244,11 @@ || configOption.getName().equalsIgnoreCase( "ignoredRoles")) { // fill lists - Set<AtomicRole> atomicsSet = config + Set<ObjectProperty> atomicsSet = config .getReasoningService().getAtomicRoles(); - LinkedList<AtomicRole> atomicRoles = new LinkedList<AtomicRole>( + LinkedList<ObjectProperty> atomicRoles = new LinkedList<ObjectProperty>( atomicsSet); - for (AtomicRole ind : atomicRoles) + for (ObjectProperty ind : atomicRoles) cBL.add(ind.getName()); } } Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2008-02-11 15:03:50 UTC (rev 539) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2008-02-11 15:24:02 UTC (rev 540) @@ -203,11 +203,6 @@ } final public void Start() throws ParseException { - ConceptAssertion conceptAssertion; - RoleAssertion roleAssertion; - RBoxAxiom rBoxAxiom; - Equality equality; - Inclusion inclusion; ConfFileOption confOption; label_1: while (true) { @@ -588,6 +583,42 @@ finally { jj_save(7, xla); } } + final private boolean jj_3_7() { + if (jj_scan_token(26)) return true; + if (jj_scan_token(31)) return true; + return false; + } + + final private boolean jj_3R_12() { + if (jj_scan_token(29)) return true; + if (jj_3R_11()) return true; + return false; + } + + final private boolean jj_3R_17() { + if (jj_3R_11()) return true; + return false; + } + + final private boolean jj_3_6() { + if (jj_scan_token(28)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_15()) { + jj_scanpos = xsp; + if (jj_3R_16()) return true; + } + if (jj_scan_token(29)) return true; + xsp = jj_scanpos; + if (jj_3R_17()) { + jj_scanpos = xsp; + if (jj_3R_18()) return true; + } + if (jj_scan_token(30)) return true; + if (jj_scan_token(29)) return true; + return false; + } + final private boolean jj_3_5() { Token xsp; xsp = jj_scanpos; @@ -726,42 +757,6 @@ return false; } - final private boolean jj_3_7() { - if (jj_scan_token(26)) return true; - if (jj_scan_token(31)) return true; - return false; - } - - final private boolean jj_3R_12() { - if (jj_scan_token(29)) return true; - if (jj_3R_11()) return true; - return false; - } - - final private boolean jj_3R_17() { - if (jj_3R_11()) return true; - return false; - } - - final private boolean jj_3_6() { - if (jj_scan_token(28)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_15()) { - jj_scanpos = xsp; - if (jj_3R_16()) return true; - } - if (jj_scan_token(29)) return true; - xsp = jj_scanpos; - if (jj_3R_17()) { - jj_scanpos = xsp; - if (jj_3R_18()) return true; - } - if (jj_scan_token(30)) return true; - if (jj_scan_token(29)) return true; - return false; - } - public ConfParserTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; Modified: trunk/src/dl-learner/org/dllearner/parser/KBParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-11 15:03:50 UTC (rev 539) +++ trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-11 15:24:02 UTC (rev 540) @@ -35,7 +35,7 @@ final public KB KB() throws ParseException { ConceptAssertion conceptAssertion; - RoleAssertion roleAssertion; + ObjectPropertyAssertion roleAssertion; RBoxAxiom rBoxAxiom; Equality equality; Inclusion inclusion; @@ -123,9 +123,9 @@ throw new Error("Missing return statement in function"); } - final public RoleAssertion ABoxRole() throws ParseException { + final public ObjectPropertyAssertion ABoxRole() throws ParseException { boolean isNegated=false; - AtomicRole ar; + ObjectProperty ar; Individual i1,i2; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: @@ -136,7 +136,7 @@ jj_la1[2] = jj_gen; ; } - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(22); i1 = Individual(); jj_consume_token(24); @@ -146,15 +146,15 @@ if(isNegated) {if (true) throw new Error("negated role assertions not supported yet");} else - {if (true) return new RoleAssertion(ar,i1,i2);} + {if (true) return new ObjectPropertyAssertion(ar,i1,i2);} throw new Error("Missing return statement in function"); } final public TransitiveRoleAxiom Transitive() throws ParseException { - AtomicRole ar; + ObjectProperty ar; jj_consume_token(28); jj_consume_token(22); - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(23); jj_consume_token(COMMAND_END); {if (true) return new TransitiveRoleAxiom(ar);} @@ -162,10 +162,10 @@ } final public FunctionalRoleAxiom Functional() throws ParseException { - AtomicRole ar; + ObjectProperty ar; jj_consume_token(29); jj_consume_token(22); - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(23); jj_consume_token(COMMAND_END); {if (true) return new FunctionalRoleAxiom(ar);} @@ -173,10 +173,10 @@ } final public SymmetricRoleAxiom Symmetric() throws ParseException { - AtomicRole ar; + ObjectProperty ar; jj_consume_token(30); jj_consume_token(22); - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(23); jj_consume_token(COMMAND_END); {if (true) return new SymmetricRoleAxiom(ar);} @@ -184,12 +184,12 @@ } final public InverseRoleAxiom Inverse() throws ParseException { - AtomicRole ar1,ar2; + ObjectProperty ar1,ar2; jj_consume_token(31); jj_consume_token(22); - ar1 = AtomicRole(); + ar1 = ObjectProperty(); jj_consume_token(24); - ar2 = AtomicRole(); + ar2 = ObjectProperty(); jj_consume_token(23); jj_consume_token(COMMAND_END); {if (true) return new InverseRoleAxiom(ar1,ar2);} @@ -197,12 +197,12 @@ } final public SubRoleAxiom Subrole() throws ParseException { - AtomicRole ar1,ar2; + ObjectProperty ar1,ar2; jj_consume_token(32); jj_consume_token(22); - ar1 = AtomicRole(); + ar1 = ObjectProperty(); jj_consume_token(24); - ar2 = AtomicRole(); + ar2 = ObjectProperty(); jj_consume_token(23); jj_consume_token(COMMAND_END); {if (true) return new SubRoleAxiom(ar1,ar2);} @@ -246,7 +246,7 @@ final public Concept Concept() throws ParseException { Concept c,c1,c2; AtomicConcept ac; - AtomicRole ar; + ObjectProperty ar; String s; int i; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -283,14 +283,14 @@ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EXISTS: Exists(); - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(COMMAND_END); c = Concept(); {if (true) return new Exists(ar,c);} break; case ALL: All(); - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(COMMAND_END); c = Concept(); {if (true) return new All(ar,c);} @@ -303,7 +303,7 @@ case GE: GE(); i = Integer(); - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(COMMAND_END); c = Concept(); {if (true) return new GreaterEqual(i,ar,c);} @@ -311,7 +311,7 @@ case LE: LE(); i = Integer(); - ar = AtomicRole(); + ar = ObjectProperty(); jj_consume_token(COMMAND_END); c = Concept(); {if (true) return new LessEqual(i,ar,c);} @@ -380,7 +380,7 @@ throw new Error("Missing return statement in function"); } - final public AtomicRole AtomicRole() throws ParseException { + final public ObjectProperty ObjectProperty() throws ParseException { String name; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ID: @@ -394,7 +394,7 @@ jj_consume_token(-1); throw new ParseException(); } - {if (true) return new AtomicRole(getInternalURI(name));} + {if (true) return new ObjectProperty(getInternalURI(name));} throw new Error("Missing return statement in function"); } Modified: trunk/src/dl-learner/org/dllearner/parser/conf.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/conf.jj 2008-02-11 15:03:50 UTC (rev 539) +++ trunk/src/dl-learner/org/dllearner/parser/conf.jj 2008-02-11 15:24:02 UTC (rev 540) @@ -267,11 +267,6 @@ void Start() : { - ConceptAssertion conceptAssertion; - RoleAssertion roleAssertion; - RBoxAxiom rBoxAxiom; - Equality equality; - Inclusion inclusion; ConfFileOption confOption; } { Modified: trunk/src/dl-learner/org/dllearner/parser/kb.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-11 15:03:50 UTC (rev 539) +++ trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-11 15:24:02 UTC (rev 540) @@ -97,7 +97,7 @@ KB KB() : { ConceptAssertion conceptAssertion; - RoleAssertion roleAssertion; + ObjectPropertyAssertion roleAssertion; RBoxAxiom rBoxAxiom; Equality equality; Inclusion inclusion; @@ -106,7 +106,7 @@ { ( LOOKAHEAD(Concept() "(" Individual() ")" <COMMAND_END>) conceptAssertion=ABoxConcept() { kb.addABoxAxiom(conceptAssertion); } - | LOOKAHEAD([Not()] AtomicRole() "(" Individual() ",") roleAssertion = ABoxRole() + | LOOKAHEAD([Not()] ObjectProperty() "(" Individual() ",") roleAssertion = ABoxRole() { kb.addABoxAxiom(roleAssertion); } | rBoxAxiom = Transitive() { kb.addRBoxAxiom(rBoxAxiom); } @@ -134,50 +134,50 @@ { return new ConceptAssertion(c,i); } } -RoleAssertion ABoxRole() : +ObjectPropertyAssertion ABoxRole() : { boolean isNegated=false; - AtomicRole ar; + ObjectProperty ar; Individual i1,i2; } { - [Not() {isNegated=true;}] ar=AtomicRole() "(" i1=Individual() "," i2=Individual() ")" <COMMAND_END> + [Not() {isNegated=true;}] ar=ObjectProperty() "(" i1=Individual() "," i2=Individual() ")" <COMMAND_END> { if(isNegated) throw new Error("negated role assertions not supported yet"); else - return new RoleAssertion(ar,i1,i2); + return new ObjectPropertyAssertion(ar,i1,i2); } } -TransitiveRoleAxiom Transitive() : {AtomicRole ar;} +TransitiveRoleAxiom Transitive() : {ObjectProperty ar;} { - "Transitive" "(" ar=AtomicRole() ")" <COMMAND_END> + "Transitive" "(" ar=ObjectProperty() ")" <COMMAND_END> { return new TransitiveRoleAxiom(ar); } } -FunctionalRoleAxiom Functional() : {AtomicRole ar;} +FunctionalRoleAxiom Functional() : {ObjectProperty ar;} { - "Functional" "(" ar=AtomicRole() ")" <COMMAND_END> + "Functional" "(" ar=ObjectProperty() ")" <COMMAND_END> { return new FunctionalRoleAxiom(ar); } } -SymmetricRoleAxiom Symmetric() : {AtomicRole ar;} +SymmetricRoleAxiom Symmetric() : {ObjectProperty ar;} { - "Symmetric" "(" ar=AtomicRole() ")" <COMMAND_END> + "Symmetric" "(" ar=ObjectProperty() ")" <COMMAND_END> { return new SymmetricRoleAxiom(ar); } } -InverseRoleAxiom Inverse() : {AtomicRole ar1,ar2;} +InverseRoleAxiom Inverse() : {ObjectProperty ar1,ar2;} { - "Inverse" "(" ar1=AtomicRole() "," ar2=AtomicRole() ")" <COMMAND_END> + "Inverse" "(" ar1=ObjectProperty() "," ar2=ObjectProperty() ")" <COMMAND_END> { return new InverseRoleAxiom(ar1,ar2); } } -SubRoleAxiom Subrole() : {AtomicRole ar1,ar2;} +SubRoleAxiom Subrole() : {ObjectProperty ar1,ar2;} { - "Subrole" "(" ar1=AtomicRole() "," ar2=AtomicRole() ")" <COMMAND_END> + "Subrole" "(" ar1=ObjectProperty() "," ar2=ObjectProperty() ")" <COMMAND_END> { return new SubRoleAxiom(ar1,ar2);} } @@ -197,7 +197,7 @@ { Concept c,c1,c2; AtomicConcept ac; - AtomicRole ar; + ObjectProperty ar; String s; int i; } @@ -215,21 +215,21 @@ // EXISTS oder ALL reicht aus um richtigen Zweig zu w�hlen // | Exists() s=Id() "." c=Concept() // {return new Exists(new AtomicRole(s),c); } - | Exists() ar=AtomicRole() "." c=Concept() + | Exists() ar=ObjectProperty() "." c=Concept() {return new Exists(ar,c); } // | All() s=Id() "." c=Concept() // {return new All(new AtomicRole(s),c); } - | All() ar=AtomicRole() "." c=Concept() + | All() ar=ObjectProperty() "." c=Concept() {return new All(ar,c); } | Not() c=Concept() {return new Negation(c); } // | GE() i=Integer() s=Id() "." c=Concept() // {return new GreaterEqual(i,new AtomicRole(s),c);} - | GE() i=Integer() ar=AtomicRole() "." c=Concept() + | GE() i=Integer() ar=ObjectProperty() "." c=Concept() {return new GreaterEqual(i,ar,c);} // | LE() i=Integer() s=Id() "." c=Concept() // {return new LessEqual(i,new AtomicRole(s),c);} - | LE() i=Integer() ar=AtomicRole() "." c=Concept() + | LE() i=Integer() ar=ObjectProperty() "." c=Concept() {return new LessEqual(i,ar,c);} } @@ -254,14 +254,14 @@ } } -AtomicRole AtomicRole() : +ObjectProperty ObjectProperty() : { String name; } { (name=Id() | name=String()) { - return new AtomicRole(getInternalURI(name)); + return new ObjectProperty(getInternalURI(name)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-11 17:41:17
|
Revision: 541 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=541&view=rev Author: jenslehmann Date: 2008-02-11 09:41:10 -0800 (Mon, 11 Feb 2008) Log Message: ----------- start moving core structures from mixed DL/OWL to OWL only Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/Node.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/RefinementOperator.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/SearchSpace.java trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/core/LearningProblem.java trunk/src/dl-learner/org/dllearner/core/Reasoner.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/core/Score.java trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java trunk/src/dl-learner/org/dllearner/core/owl/All.java trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Axiom.java trunk/src/dl-learner/org/dllearner/core/owl/Bottom.java trunk/src/dl-learner/org/dllearner/core/owl/Concept.java trunk/src/dl-learner/org/dllearner/core/owl/ConceptAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/Conjunction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/Disjunction.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/Equality.java trunk/src/dl-learner/org/dllearner/core/owl/Exists.java trunk/src/dl-learner/org/dllearner/core/owl/FlatABox.java trunk/src/dl-learner/org/dllearner/core/owl/FunctionalRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/GreaterEqual.java trunk/src/dl-learner/org/dllearner/core/owl/Inclusion.java trunk/src/dl-learner/org/dllearner/core/owl/Individual.java trunk/src/dl-learner/org/dllearner/core/owl/InverseRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/KB.java trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java trunk/src/dl-learner/org/dllearner/core/owl/LessEqual.java trunk/src/dl-learner/org/dllearner/core/owl/MultiConjunction.java trunk/src/dl-learner/org/dllearner/core/owl/MultiDisjunction.java trunk/src/dl-learner/org/dllearner/core/owl/Negation.java trunk/src/dl-learner/org/dllearner/core/owl/NumberRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyExpression.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java trunk/src/dl-learner/org/dllearner/core/owl/Property.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/Quantification.java trunk/src/dl-learner/org/dllearner/core/owl/RBoxAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/RoleHierarchy.java trunk/src/dl-learner/org/dllearner/core/owl/SubRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java trunk/src/dl-learner/org/dllearner/core/owl/SymmetricRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Top.java trunk/src/dl-learner/org/dllearner/core/owl/TransitiveRoleAxiom.java trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/learningproblems/EvaluationCache.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyInclusionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java trunk/src/dl-learner/org/dllearner/learningproblems/RoleLearning.java trunk/src/dl-learner/org/dllearner/learningproblems/ScoreThreeValued.java trunk/src/dl-learner/org/dllearner/learningproblems/ScoreTwoValued.java trunk/src/dl-learner/org/dllearner/parser/ConfParser.java trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/KBParser.java trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/conf.jj trunk/src/dl-learner/org/dllearner/parser/kb.jj trunk/src/dl-learner/org/dllearner/reasoning/DIGConverter.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrieval.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/utilities/ConceptComparator.java trunk/src/dl-learner/org/dllearner/utilities/ConceptTransformation.java trunk/src/dl-learner/org/dllearner/utilities/CrossValidation.java trunk/src/dl-learner/org/dllearner/utilities/Datastructures.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java trunk/src/dl-learner/org/dllearner/utilities/OntologyClassRewriter.java trunk/src/dl-learner/org/dllearner/utilities/RoleComparator.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/owl/ trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/core/dl/ trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-11 17:41:10 UTC (rev 541) @@ -35,16 +35,16 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.dl.All; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Bottom; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Conjunction; -import org.dllearner.core.dl.Disjunction; -import org.dllearner.core.dl.Exists; -import org.dllearner.core.dl.Negation; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.All; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Bottom; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Conjunction; +import org.dllearner.core.owl.Disjunction; +import org.dllearner.core.owl.Exists; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.Top; /** * A brute force learning algorithm. Modified: trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-02-11 17:41:10 UTC (rev 541) @@ -33,7 +33,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; public class RandomGuesser extends LearningAlgorithm { Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-11 17:41:10 UTC (rev 541) @@ -2,7 +2,7 @@ import java.util.Map; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; public class ADC extends Concept { Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-02-11 17:41:10 UTC (rev 541) @@ -41,8 +41,8 @@ import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Top; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.Helper; Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java 2008-02-11 17:41:10 UTC (rev 541) @@ -10,18 +10,18 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasoningMethodUnsupportedException; import org.dllearner.core.Score; -import org.dllearner.core.dl.All; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Bottom; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Exists; -import org.dllearner.core.dl.FlatABox; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.MultiConjunction; -import org.dllearner.core.dl.MultiDisjunction; -import org.dllearner.core.dl.Negation; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.All; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Bottom; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Exists; +import org.dllearner.core.owl.FlatABox; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.MultiConjunction; +import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.Top; import org.dllearner.learningproblems.PosNegDefinitionLPStrict; import org.dllearner.learningproblems.ScoreThreeValued; import org.dllearner.reasoning.FastRetrieval; Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java 2008-02-11 17:41:10 UTC (rev 541) @@ -21,7 +21,7 @@ package org.dllearner.algorithms.gp; import org.dllearner.core.Score; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; /** * This class represents a program, i.e. an individual. Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java 2008-02-11 17:41:10 UTC (rev 541) @@ -7,7 +7,7 @@ import org.dllearner.algorithms.gp.Program; import org.dllearner.core.Score; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.ConceptComparator; import org.dllearner.utilities.ConceptTransformation; Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java 2008-02-11 17:41:10 UTC (rev 541) @@ -9,17 +9,17 @@ import org.dllearner.algorithms.refinement.RefinementOperator; import org.dllearner.core.ReasoningService; -import org.dllearner.core.dl.All; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Bottom; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Exists; -import org.dllearner.core.dl.MultiConjunction; -import org.dllearner.core.dl.MultiDisjunction; -import org.dllearner.core.dl.Negation; -import org.dllearner.core.dl.Quantification; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.All; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Bottom; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Exists; +import org.dllearner.core.owl.MultiConjunction; +import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.Quantification; +import org.dllearner.core.owl.Top; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.ConceptComparator; Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java 2008-02-11 17:41:10 UTC (rev 541) @@ -9,17 +9,17 @@ import org.dllearner.algorithms.refinement.RefinementOperator; import org.dllearner.core.ReasoningService; -import org.dllearner.core.dl.All; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Bottom; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Exists; -import org.dllearner.core.dl.MultiConjunction; -import org.dllearner.core.dl.MultiDisjunction; -import org.dllearner.core.dl.Negation; -import org.dllearner.core.dl.Quantification; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.All; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Bottom; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Exists; +import org.dllearner.core.owl.MultiConjunction; +import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.Quantification; +import org.dllearner.core.owl.Top; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.ConceptComparator; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java 2008-02-11 17:41:10 UTC (rev 541) @@ -23,8 +23,8 @@ import java.util.Set; import java.util.TreeSet; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; import org.dllearner.utilities.ConceptComparator; /** Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-02-11 17:41:10 UTC (rev 541) @@ -39,9 +39,9 @@ import org.dllearner.core.config.DoubleConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.ObjectProperty; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.utilities.Files; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-02-11 17:41:10 UTC (rev 541) @@ -36,11 +36,11 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.MultiConjunction; -import org.dllearner.core.dl.MultiDisjunction; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.MultiConjunction; +import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.Top; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.utilities.ConceptComparator; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/Node.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/Node.java 2008-02-11 17:41:10 UTC (rev 541) @@ -3,7 +3,7 @@ import java.util.Set; import java.util.TreeSet; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; import org.dllearner.utilities.ConceptComparator; public class Node { Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-02-11 17:41:10 UTC (rev 541) @@ -24,12 +24,12 @@ import org.dllearner.core.config.DoubleConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.MultiConjunction; -import org.dllearner.core.dl.MultiDisjunction; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.MultiConjunction; +import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.Top; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.utilities.ConceptComparator; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/RefinementOperator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/RefinementOperator.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/RefinementOperator.java 2008-02-11 17:41:10 UTC (rev 541) @@ -3,7 +3,7 @@ import java.util.List; import java.util.Set; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; public interface RefinementOperator { Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java 2008-02-11 17:41:10 UTC (rev 541) @@ -30,20 +30,20 @@ import java.util.TreeSet; import org.dllearner.core.ReasoningService; -import org.dllearner.core.dl.All; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Bottom; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Conjunction; -import org.dllearner.core.dl.Disjunction; -import org.dllearner.core.dl.Exists; -import org.dllearner.core.dl.MultiConjunction; -import org.dllearner.core.dl.MultiDisjunction; -import org.dllearner.core.dl.Negation; -import org.dllearner.core.dl.Quantification; -import org.dllearner.core.dl.ObjectPropertyExpression; -import org.dllearner.core.dl.Top; +import org.dllearner.core.owl.All; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Bottom; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Conjunction; +import org.dllearner.core.owl.Disjunction; +import org.dllearner.core.owl.Exists; +import org.dllearner.core.owl.MultiConjunction; +import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectPropertyExpression; +import org.dllearner.core.owl.Quantification; +import org.dllearner.core.owl.Top; import org.dllearner.utilities.ConceptComparator; import org.dllearner.utilities.ConceptTransformation; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/SearchSpace.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/SearchSpace.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/SearchSpace.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,6 +1,6 @@ package org.dllearner.algorithms.refinement; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; /** * Soll hauptsächlich dazu dienen zu testen, ob ein Konzept im Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-11 17:41:10 UTC (rev 541) @@ -61,10 +61,10 @@ import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.config.StringTupleListConfigOption; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.ObjectProperty; import org.dllearner.kb.KBFile; import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.SparqlKnowledgeSource; Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-02-11 17:41:10 UTC (rev 541) @@ -23,7 +23,7 @@ import java.util.LinkedList; import java.util.List; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; /** * @author Jens Lehmann Modified: trunk/src/dl-learner/org/dllearner/core/LearningProblem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningProblem.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/LearningProblem.java 2008-02-11 17:41:10 UTC (rev 541) @@ -19,7 +19,7 @@ */ package org.dllearner.core; -import org.dllearner.core.dl.Concept; +import org.dllearner.core.owl.Concept; /** * Base class for all learning problems. Modified: trunk/src/dl-learner/org/dllearner/core/Reasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Reasoner.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/Reasoner.java 2008-02-11 17:41:10 UTC (rev 541) @@ -24,12 +24,12 @@ import java.util.Set; import java.util.SortedSet; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.RoleHierarchy; -import org.dllearner.core.dl.SubsumptionHierarchy; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.RoleHierarchy; +import org.dllearner.core.owl.SubsumptionHierarchy; import org.dllearner.reasoning.ReasonerType; import org.dllearner.utilities.SortedSetTuple; Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-02-11 17:41:10 UTC (rev 541) @@ -25,12 +25,12 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.RoleHierarchy; -import org.dllearner.core.dl.SubsumptionHierarchy; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.RoleHierarchy; +import org.dllearner.core.owl.SubsumptionHierarchy; import org.dllearner.utilities.SortedSetTuple; /** Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-02-11 17:41:10 UTC (rev 541) @@ -27,12 +27,12 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.RoleHierarchy; -import org.dllearner.core.dl.SubsumptionHierarchy; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.RoleHierarchy; +import org.dllearner.core.owl.SubsumptionHierarchy; import org.dllearner.reasoning.ReasonerType; import org.dllearner.utilities.SortedSetTuple; Modified: trunk/src/dl-learner/org/dllearner/core/Score.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Score.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/Score.java 2008-02-11 17:41:10 UTC (rev 541) @@ -2,7 +2,7 @@ import java.util.Set; -import org.dllearner.core.dl.Individual; +import org.dllearner.core.owl.Individual; public abstract class Score { public abstract double getScore(); Modified: trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java 2008-02-11 17:41:10 UTC (rev 541) @@ -23,9 +23,9 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Individual; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.ObjectProperty; import org.dllearner.utilities.ConceptComparator; /** Copied: trunk/src/dl-learner/org/dllearner/core/owl (from rev 540, trunk/src/dl-learner/org/dllearner/core/dl) Modified: trunk/src/dl-learner/org/dllearner/core/owl/All.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/All.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/All.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/AssertionalAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; public abstract class AssertionalAxiom extends Axiom { Deleted: trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/AtomicConcept.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,63 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.core.dl; - -import java.util.Map; - -import org.dllearner.utilities.Helper; - -/** - * Represents an atomic concept in a knowledge base / ontology, - * e.g. "car", "person". - * - * @author Jens Lehmann - * - */ -public class AtomicConcept extends Concept { - - String name; - - public AtomicConcept(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public int getLength() { - return 1; - } - - @Override - public int getArity() { - return 0; - } - - @Override - public String toString() { - return name; - } - - public String toString(String baseURI, Map<String,String> prefixes) { - return Helper.getAbbreviatedString(name, baseURI, prefixes); - } - -} Added: trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java 2008-02-11 17:41:10 UTC (rev 541) @@ -0,0 +1,63 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +import org.dllearner.utilities.Helper; + +/** + * Represents an atomic concept in a knowledge base / ontology, + * e.g. "car", "person". + * + * @author Jens Lehmann + * + */ +public class AtomicConcept extends Concept { + + String name; + + public AtomicConcept(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public int getLength() { + return 1; + } + + @Override + public int getArity() { + return 0; + } + + @Override + public String toString() { + return name; + } + + public String toString(String baseURI, Map<String,String> prefixes) { + return Helper.getAbbreviatedString(name, baseURI, prefixes); + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/Axiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Axiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Axiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; public abstract class Axiom implements KBElement { Modified: trunk/src/dl-learner/org/dllearner/core/owl/Bottom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Bottom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Bottom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Concept.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Concept.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Concept.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.LinkedList; import java.util.List; Modified: trunk/src/dl-learner/org/dllearner/core/owl/ConceptAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/ConceptAssertion.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Conjunction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Conjunction.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Conjunction.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/DatatypeProperty.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/DatatypePropertyAssertion.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyAssertion.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; /** * A datatype property assertion. Modified: trunk/src/dl-learner/org/dllearner/core/owl/Disjunction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Disjunction.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Disjunction.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/DoubleDatatypePropertyAssertion.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Equality.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Equality.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Equality.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Exists.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Exists.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Exists.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/FlatABox.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/FlatABox.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/FlatABox.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.HashMap; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/FunctionalRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/FunctionalRoleAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/FunctionalRoleAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/GreaterEqual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/GreaterEqual.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/GreaterEqual.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Inclusion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Inclusion.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Inclusion.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Individual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Individual.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Individual.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/InverseRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/InverseRoleAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/InverseRoleAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/KB.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.HashSet; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/KBElement.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/LessEqual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/LessEqual.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/LessEqual.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/MultiConjunction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/MultiConjunction.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/MultiConjunction.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.List; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/MultiDisjunction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/MultiDisjunction.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/MultiDisjunction.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.List; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Negation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Negation.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Negation.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/NumberRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/NumberRestriction.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/NumberRestriction.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; public abstract class NumberRestriction extends Concept { Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectProperty.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyAssertion.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyExpression.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyExpression.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyExpression.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; /** * An object property expression is an object property construct, which Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ObjectPropertyInverse.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java 2008-02-11 17:41:10 UTC (rev 541) @@ -18,7 +18,7 @@ * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/Property.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Property.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Property.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; /** * @author Jens Lehmann Modified: trunk/src/dl-learner/org/dllearner/core/owl/PropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/PropertyAssertion.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyAssertion.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; /** * @author Jens Lehmann Modified: trunk/src/dl-learner/org/dllearner/core/owl/Quantification.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Quantification.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Quantification.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; public abstract class Quantification extends Concept { Modified: trunk/src/dl-learner/org/dllearner/core/owl/RBoxAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/RBoxAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/RBoxAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; public abstract class RBoxAxiom extends Axiom { Modified: trunk/src/dl-learner/org/dllearner/core/owl/RoleHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/RoleHierarchy.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/RoleHierarchy.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Set; import java.util.SortedSet; Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/SubRoleAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/SubRoleAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/SubsumptionHierarchy.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java 2008-02-11 17:41:10 UTC (rev 541) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Set; import java.util.SortedSet; Modified: trunk/src/dl-learner/org/dllearner/core/owl/SymmetricRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/SymmetricRoleAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/SymmetricRoleAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/TerminologicalAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; public abstract class TerminologicalAxiom extends Axiom { Modified: trunk/src/dl-learner/org/dllearner/core/owl/Top.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Top.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/Top.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/core/owl/TransitiveRoleAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/TransitiveRoleAxiom.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/core/owl/TransitiveRoleAxiom.java 2008-02-11 17:41:10 UTC (rev 541) @@ -1,4 +1,4 @@ -package org.dllearner.core.dl; +package org.dllearner.core.owl; import java.util.Map; Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-11 17:41:10 UTC (rev 541) @@ -29,16 +29,16 @@ import java.util.List; import java.util.Map; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.DatatypeProperty; -import org.dllearner.core.dl.DatatypePropertyAssertion; -import org.dllearner.core.dl.DoubleDatatypePropertyAssertion; -import org.dllearner.core.dl.ObjectProperty; -import org.dllearner.core.dl.Axiom; -import org.dllearner.core.dl.ConceptAssertion; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.KB; -import org.dllearner.core.dl.ObjectPropertyAssertion; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Axiom; +import org.dllearner.core.owl.ConceptAssertion; +import org.dllearner.core.owl.DatatypeProperty; +import org.dllearner.core.owl.DatatypePropertyAssertion; +import org.dllearner.core.owl.DoubleDatatypePropertyAssertion; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.KB; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectPropertyAssertion; import org.dllearner.parser.ParseException; import org.dllearner.parser.PrologParser; import org.dllearner.prolog.Atom; Modified: trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java 2008-02-11 17:41:10 UTC (rev 541) @@ -45,8 +45,8 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.reasoning.DIGReasoner; Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-02-11 17:41:10 UTC (rev 541) @@ -42,9 +42,9 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.ObjectProperty; +import org.dllearner.core.owl.AtomicConcept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.ObjectProperty; /** * WidgetPanelStringSet Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-11 17:41:10 UTC (rev 541) @@ -32,7 +32,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.dl.KB; +import org.dllearner.core.owl.KB; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; import org.dllearner.reasoning.DIGConverter; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-02-11 17:41:10 UTC (rev 541) @@ -43,7 +43,7 @@ import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.config.StringTupleListConfigOption; -import org.dllearner.core.dl.KB; +import org.dllearner.core.owl.KB; import org.dllearner.kb.sparql.configuration.SparqlEndpoint; import org.dllearner.kb.sparql.configuration.SparqlQueryType; import org.dllearner.parser.KBParser; Modified: trunk/src/dl-learner/org/dllearner/learningproblems/EvaluationCache.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluationCache.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/learningproblems/EvaluationCache.java 2008-02-11 17:41:10 UTC (rev 541) @@ -23,10 +23,10 @@ import java.util.SortedSet; import java.util.TreeMap; -import org.dllearner.core.dl.Concept; -import org.dllearner.core.dl.Individual; -import org.dllearner.core.dl.MultiConjunction; -import org.dllearner.core.dl.MultiDisjunction; +import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.MultiConjunction; +import org.dllearner.core.owl.MultiDisjunction; import org.dllearner.utilities.ConceptComparator; import org.dllearner.utilities.Helper; import org.dllearner.utilities.SortedSetTuple; Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-02-11 15:24:02 UTC (rev 540) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinit... [truncated message content] |
From: <jen...@us...> - 2008-02-11 18:50:54
|
Revision: 542 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=542&view=rev Author: jenslehmann Date: 2008-02-11 10:50:44 -0800 (Mon, 11 Feb 2008) Log Message: ----------- - refactored some DL elements to OWL elements - enhanced datatype support Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/Node.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/RefinementOperator.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/SearchSpace.java trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/core/LearningProblem.java trunk/src/dl-learner/org/dllearner/core/Reasoner.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/core/config/CommonConfigMappings.java trunk/src/dl-learner/org/dllearner/core/owl/KB.java trunk/src/dl-learner/org/dllearner/core/owl/Negation.java trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/learningproblems/EvaluationCache.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyInclusionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/RoleLearning.java trunk/src/dl-learner/org/dllearner/parser/KBParser.java trunk/src/dl-learner/org/dllearner/parser/kb.jj trunk/src/dl-learner/org/dllearner/reasoning/DIGConverter.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrieval.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/utilities/ConceptComparator.java trunk/src/dl-learner/org/dllearner/utilities/ConceptTransformation.java trunk/src/dl-learner/org/dllearner/utilities/CrossValidation.java trunk/src/dl-learner/org/dllearner/utilities/Datastructures.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java trunk/src/dl-learner/org/dllearner/utilities/OntologyClassRewriter.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Description.java trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectQuantorRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Thing.java trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Union.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/core/owl/All.java trunk/src/dl-learner/org/dllearner/core/owl/AtomicConcept.java trunk/src/dl-learner/org/dllearner/core/owl/Bottom.java trunk/src/dl-learner/org/dllearner/core/owl/Concept.java trunk/src/dl-learner/org/dllearner/core/owl/ConceptAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/Conjunction.java trunk/src/dl-learner/org/dllearner/core/owl/Disjunction.java trunk/src/dl-learner/org/dllearner/core/owl/Equality.java trunk/src/dl-learner/org/dllearner/core/owl/Exists.java trunk/src/dl-learner/org/dllearner/core/owl/FunctionalRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/GreaterEqual.java trunk/src/dl-learner/org/dllearner/core/owl/Inclusion.java trunk/src/dl-learner/org/dllearner/core/owl/InverseRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/LessEqual.java trunk/src/dl-learner/org/dllearner/core/owl/MultiConjunction.java trunk/src/dl-learner/org/dllearner/core/owl/MultiDisjunction.java trunk/src/dl-learner/org/dllearner/core/owl/NumberRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/Quantification.java trunk/src/dl-learner/org/dllearner/core/owl/RBoxAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/RoleHierarchy.java trunk/src/dl-learner/org/dllearner/core/owl/SubRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SymmetricRoleAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Top.java trunk/src/dl-learner/org/dllearner/core/owl/TransitiveRoleAxiom.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-11 18:50:44 UTC (rev 542) @@ -35,16 +35,16 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.owl.All; -import org.dllearner.core.owl.AtomicConcept; -import org.dllearner.core.owl.Bottom; -import org.dllearner.core.owl.Concept; -import org.dllearner.core.owl.Conjunction; -import org.dllearner.core.owl.Disjunction; -import org.dllearner.core.owl.Exists; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.Union; +import org.dllearner.core.owl.ObjectAllRestriction; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.Negation; import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.Top; +import org.dllearner.core.owl.Thing; /** * A brute force learning algorithm. @@ -59,14 +59,14 @@ private LearningProblem learningProblem; - private Concept bestDefinition; + private Description bestDefinition; private Score bestScore; private Integer maxLength = 7; private String returnType; // list of all generated concepts sorted by length - private Map<Integer,List<Concept>> generatedDefinitions = new HashMap<Integer,List<Concept>>(); + private Map<Integer,List<Description>> generatedDefinitions = new HashMap<Integer,List<Description>>(); public BruteForceLearner(LearningProblem learningProblem, ReasoningService rs) { this.learningProblem = learningProblem; @@ -159,12 +159,12 @@ long startTime = System.currentTimeMillis(); System.out.print("Testing definitions of length " + i + " ... "); count = 0; - for(Concept program : generatedDefinitions.get(i)) { + for(Description program : generatedDefinitions.get(i)) { // if a return type is already given an appropriate tree is // generated here - Concept newRoot; + Description newRoot; if(returnType != null) { - newRoot = new Conjunction(new AtomicConcept(returnType),program); + newRoot = new Intersection(new NamedClass(returnType),program); } else newRoot = program; @@ -189,19 +189,19 @@ } private void generatePrograms(int length) { - generatedDefinitions.put(length,new LinkedList<Concept>()); + generatedDefinitions.put(length,new LinkedList<Description>()); if(length==1) { - generatedDefinitions.get(1).add(new Top()); - generatedDefinitions.get(1).add(new Bottom()); - for(AtomicConcept atomicConcept : learningProblem.getReasoningService().getAtomicConcepts()) { + generatedDefinitions.get(1).add(new Thing()); + generatedDefinitions.get(1).add(new Nothing()); + for(NamedClass atomicConcept : learningProblem.getReasoningService().getAtomicConcepts()) { generatedDefinitions.get(1).add(atomicConcept); } } if(length>1) { // negation - for(Concept childNode : generatedDefinitions.get(length-1)) { - Concept root = new Negation(childNode); + for(Description childNode : generatedDefinitions.get(length-1)) { + Description root = new Negation(childNode); generatedDefinitions.get(length).add(root); } } @@ -216,15 +216,15 @@ for(int z=1; z<=Math.floor(0.5*(length-1)); z++) { // cycle through all concepts of length z (left subtree) - for(Concept leftChild : generatedDefinitions.get(z)) { + for(Description leftChild : generatedDefinitions.get(z)) { // cycle thorugh all concept of lengt "length-z-1" (right subtree) - for(Concept rightChild : generatedDefinitions.get(length-z-1)) { + for(Description rightChild : generatedDefinitions.get(length-z-1)) { // create concept tree - Concept root; + Description root; if(i==0) { - root = new Disjunction(leftChild,rightChild); + root = new Union(leftChild,rightChild); } else { - root = new Conjunction(leftChild,rightChild); + root = new Intersection(leftChild,rightChild); } // Please not that we only set links here, i.e.: @@ -250,12 +250,12 @@ } // EXISTS and ALL - for(Concept childNode : generatedDefinitions.get(length-2)) { + for(Description childNode : generatedDefinitions.get(length-2)) { for(ObjectProperty atomicRole : learningProblem.getReasoningService().getAtomicRoles()) { - Concept root1 = new Exists(atomicRole,childNode); + Description root1 = new ObjectSomeRestriction(atomicRole,childNode); generatedDefinitions.get(length).add(root1); - Concept root2 = new All(atomicRole,childNode); + Description root2 = new ObjectAllRestriction(atomicRole,childNode); generatedDefinitions.get(length).add(root2); } } @@ -268,7 +268,7 @@ } @Override - public Concept getBestSolution() { + public Description getBestSolution() { return bestDefinition; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-02-11 18:50:44 UTC (rev 542) @@ -33,11 +33,11 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Description; public class RandomGuesser extends LearningAlgorithm { - private Concept bestDefinition = null; + private Description bestDefinition = null; private Score bestScore; private double bestFitness = Double.NEGATIVE_INFINITY; private LearningProblem learningProblem; @@ -117,7 +117,7 @@ } @Override - public Concept getBestSolution() { + public Description getBestSolution() { return bestDefinition; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-11 18:50:44 UTC (rev 542) @@ -2,9 +2,9 @@ import java.util.Map; -import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Description; -public class ADC extends Concept { +public class ADC extends Description { /* @Override Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-02-11 18:50:44 UTC (rev 542) @@ -41,8 +41,8 @@ import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.owl.Concept; -import org.dllearner.core.owl.Top; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.Helper; @@ -120,7 +120,7 @@ private long startTime; private Score bestScore; - private Concept bestConcept; + private Description bestConcept; private PosNegLP learningProblem; @@ -510,7 +510,7 @@ for(int i=0; i<numberOfIndividuals; i++) { if(individuals[i].getTree().getLength()>maxConceptLength) { System.out.println("Warning: GP produced concept longer then " + maxConceptLength + ". Replacing it with TOP."); - individuals[i] = GPUtilities.createProgram(learningProblem, new Top()); + individuals[i] = GPUtilities.createProgram(learningProblem, new Thing()); } } @@ -534,10 +534,10 @@ // der echten Score entsprechen muss, d.h. hier muss die // Konzeptlänge mit einberechnet werden => deswegen werden // neue Score-Objekte generiert - Set<Entry<Concept,Score>> entrySet = psi.evalCache.entrySet(); - for(Entry<Concept,Score> entry : entrySet) { + Set<Entry<Description,Score>> entrySet = psi.evalCache.entrySet(); + for(Entry<Description,Score> entry : entrySet) { Score tmpScore = entry.getValue(); - Concept c = entry.getKey(); + Description c = entry.getKey(); tmpScore = tmpScore.getModifiedLengthScore(c.getLength()); double tmpScoreValue = tmpScore.getScore(); if(tmpScoreValue>bestValue) { @@ -820,7 +820,7 @@ private void printStatistics(Program fittestIndividual) { // output statistics: best individual, average fitness, etc. double averageFitness = getFitnessSum() / numberOfIndividuals; - Concept n = fittestIndividual.getTree(); + Description n = fittestIndividual.getTree(); int misClassifications = fittestIndividual.getScore().getNotCoveredPositives().size() + fittestIndividual.getScore().getCoveredNegatives().size(); @@ -947,7 +947,7 @@ } @Override - public Concept getBestSolution() { + public Description getBestSolution() { // return fittestIndividual.getTree(); return bestConcept; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GPUtilities.java 2008-02-11 18:50:44 UTC (rev 542) @@ -10,18 +10,18 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasoningMethodUnsupportedException; import org.dllearner.core.Score; -import org.dllearner.core.owl.All; -import org.dllearner.core.owl.AtomicConcept; -import org.dllearner.core.owl.Bottom; -import org.dllearner.core.owl.Concept; -import org.dllearner.core.owl.Exists; +import org.dllearner.core.owl.ObjectAllRestriction; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.FlatABox; import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.MultiConjunction; -import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.Union; import org.dllearner.core.owl.Negation; import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.Top; +import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.PosNegDefinitionLPStrict; import org.dllearner.learningproblems.ScoreThreeValued; import org.dllearner.reasoning.FastRetrieval; @@ -53,7 +53,7 @@ private static Random rand = new Random(); - private static Score calculateFitness(LearningProblem learningProblem, Concept hypothesis) { + private static Score calculateFitness(LearningProblem learningProblem, Description hypothesis) { return calculateFitness(learningProblem, hypothesis, null); } @@ -62,8 +62,8 @@ // (macht aber nicht so viel Sinn, da man das bei richtigen Reasoning-Algorithmen // ohnehin mit einer Erweiterung der Wissensbasis um die Inklusion Target SUBSETOF ReturnType // erschlagen kann) - private static Score calculateFitness(LearningProblem learningProblem, Concept hypothesis, Concept adc) { - Concept extendedHypothesis; + private static Score calculateFitness(LearningProblem learningProblem, Description hypothesis, Description adc) { + Description extendedHypothesis; // return type temporarily disabled // => it is probably more appropriate to have the @@ -122,11 +122,11 @@ return score; } - public static Program createProgram(LearningProblem learningProblem, Concept mainTree) { + public static Program createProgram(LearningProblem learningProblem, Description mainTree) { return new Program(calculateFitness(learningProblem, mainTree), mainTree); } - private static Program createProgram(LearningProblem learningProblem, Concept mainTree, Concept adc) { + private static Program createProgram(LearningProblem learningProblem, Description mainTree, Description adc) { return new Program(calculateFitness(learningProblem, mainTree,adc), mainTree, adc); } @@ -140,29 +140,29 @@ // TODO: hier kann man noch mehr Feinabstimmung machen, d.h. // Mutation abh�ngig von Knotenanzahl if(Math.random()<0.5) { - Concept mainTree = mutation(learningProblem, p.getTree(),true); - Concept adc = p.getAdc(); + Description mainTree = mutation(learningProblem, p.getTree(),true); + Description adc = p.getAdc(); Score score = calculateFitness(learningProblem,mainTree,adc); return new Program(score, mainTree, adc); } else { - Concept mainTree = p.getTree(); - Concept adc = mutation(learningProblem, p.getAdc(),false); + Description mainTree = p.getTree(); + Description adc = mutation(learningProblem, p.getAdc(),false); Score score = calculateFitness(learningProblem,mainTree,adc); return new Program(score, mainTree, adc); } } else { - Concept tree = mutation(learningProblem, p.getTree(),false); + Description tree = mutation(learningProblem, p.getTree(),false); Score score = calculateFitness(learningProblem, tree); return new Program(score, tree); } } - private static Concept mutation(LearningProblem learningProblem, Concept tree, boolean useADC) { + private static Description mutation(LearningProblem learningProblem, Description tree, boolean useADC) { // auch bei Mutation muss darauf geachtet werden, dass // Baum nicht modifiziert wird (sonst w�rde man automatisch auch // andere "selected individuals" modifizieren) - Concept t = (Concept) tree.clone(); + Description t = (Description) tree.clone(); // bis auf Klon Mutation genau wie vorher int size = t.getNumberOfNodes(); // TODO: auch Mutationen von Einzelknoten erlauben @@ -182,10 +182,10 @@ */ // neue Implementierung int randNr = rand.nextInt(size) + 1; - Concept st = t.getSubtree(randNr); - Concept stParent = st.getParent(); + Description st = t.getSubtree(randNr); + Description stParent = st.getParent(); stParent.getChildren().remove(st); - Concept treeNew = createGrowRandomTree(learningProblem,3, useADC); + Description treeNew = createGrowRandomTree(learningProblem,3, useADC); stParent.addChild(treeNew); } else // return createLeafNode(useADC); @@ -193,11 +193,11 @@ return t; } - private static void swapSubtrees(Concept t1, Concept t2) { + private static void swapSubtrees(Description t1, Description t2) { if (t1.getParent() != null && t2.getParent() != null) { // handling children - Concept t1Parent = t1.getParent(); - Concept t2Parent = t2.getParent(); + Description t1Parent = t1.getParent(); + Description t2Parent = t2.getParent(); // t1 is first child if (t1Parent.getChild(0).equals(t1)) t1Parent.getChildren().add(0, t2); @@ -230,7 +230,7 @@ public static Program[] crossover(LearningProblem learningProblem, Program p1, Program p2) { crossover++; if(p1.getAdc() != null) { - Concept[] pt; + Description[] pt; Program result[] = new Program[2]; // es wird entweder ADC oder Hauptbaum einem Crossover @@ -246,7 +246,7 @@ } return result; } else { - Concept[] pt = crossover(p1.getTree(), p2.getTree()); + Description[] pt = crossover(p1.getTree(), p2.getTree()); Program result[] = new Program[2]; result[0] = createProgram(learningProblem,pt[0]); result[1] = createProgram(learningProblem,pt[1]); @@ -254,18 +254,18 @@ } } - private static Concept[] crossover(Concept tree1, Concept tree2) { - Concept tree1cloned = (Concept) tree1.clone(); - Concept tree2cloned = (Concept) tree2.clone(); + private static Description[] crossover(Description tree1, Description tree2) { + Description tree1cloned = (Description) tree1.clone(); + Description tree2cloned = (Description) tree2.clone(); - Concept[] results = new Concept[2]; + Description[] results = new Description[2]; int rand1 = rand.nextInt(tree1.getNumberOfNodes()); int rand2 = rand.nextInt(tree2.getNumberOfNodes()); - Concept t1 = tree1cloned.getSubtree(rand1); - Concept t2 = tree2cloned.getSubtree(rand2); + Description t1 = tree1cloned.getSubtree(rand1); + Description t2 = tree2cloned.getSubtree(rand2); if (t1.isRoot() && !t2.isRoot()) { - Concept t2Parent = t2.getParent(); + Description t2Parent = t2.getParent(); // t2 is first child if (t2Parent.getChild(0).equals(t2)) t2Parent.getChildren().add(0, t1); @@ -278,7 +278,7 @@ results[0] = t2; results[1] = tree2cloned; } else if (!t1.isRoot() && t2.isRoot()) { - Concept t1Parent = t1.getParent(); + Description t1Parent = t1.getParent(); // t2 is first child if (t1Parent.getChild(0).equals(t1)) t1Parent.getChildren().add(0, t2); @@ -314,7 +314,7 @@ // SortedSetTuple s = new SortedSetTuple(p.getScore().getDefPosSet(),p.getScore().getDefNegSet()); // Knoten kopieren, damit er sich nicht ver�ndert (es wird sonst der // parent-Link ver�ndert) - Concept treecloned = (Concept) p.getTree().clone(); + Description treecloned = (Description) p.getTree().clone(); if(p.getAdc() != null) return createProgram(learningProblem,hillClimbing(learningProblem,treecloned,(ScoreThreeValued)p.getScore()),p.getAdc()); else @@ -326,11 +326,11 @@ // Alternativen zu speichern und dann ein Element zuf�llig auszuw�hlen, // aber w�rde man das nicht machen, dann w�re das ein starker Bias // zu z.B. Disjunktion (weil die als erstes getestet wird) - private static Concept hillClimbing(LearningProblem learningProblem, Concept node, ScoreThreeValued score) { + private static Description hillClimbing(LearningProblem learningProblem, Description node, ScoreThreeValued score) { SortedSetTuple<Individual> tuple = new SortedSetTuple<Individual>(score.getPosClassified(),score.getNegClassified()); SortedSetTuple<String> stringTuple = Helper.getStringTuple(tuple); // FlatABox abox = FlatABox.getInstance(); - Concept returnNode = node; + Description returnNode = node; // damit stellen wir sicher, dass nur Konzepte in die Auswahl // genommen werden, die besser klassifizieren als das �bergebene // Konzept (falls das nicht existiert, dann hill climbing = reproduction) @@ -422,7 +422,7 @@ // returnNode.addChild(new AtomicConcept(name)); // returnNode.addChild(node); // if(useMultiStructures) - returnNode = new MultiDisjunction(new AtomicConcept(name),node); + returnNode = new Union(new NamedClass(name),node); // else // returnNode = new Disjunction(new AtomicConcept(name),node); // wegen else if schlie�en sich die F�lle gegenseitig aus @@ -432,19 +432,19 @@ // returnNode.addChild(new AtomicConcept(name)); // returnNode.addChild(node); // if(useMultiStructures) - returnNode = new MultiConjunction(new AtomicConcept(name),node); + returnNode = new Intersection(new NamedClass(name),node); // else // returnNode = new Conjunction(new AtomicConcept(name),node); } else if(nr<sizeSum3) { name = bestNeighbours.get(3).get(nr-sizeSum2); // returnNode = new Exists(new AtomicRole(name)); // returnNode.addChild(node); - returnNode = new Exists(new ObjectProperty(name),node); + returnNode = new ObjectSomeRestriction(new ObjectProperty(name),node); } else { name = bestNeighbours.get(4).get(nr-sizeSum3); // returnNode = new All(new AtomicRole(name)); // returnNode.addChild(node); - returnNode = new All(new ObjectProperty(name),node); + returnNode = new ObjectAllRestriction(new ObjectProperty(name),node); } return returnNode; @@ -488,7 +488,7 @@ return returnMap; } - private static Concept pickTerminalSymbol(LearningProblem learningProblem, boolean useADC) { + private static Description pickTerminalSymbol(LearningProblem learningProblem, boolean useADC) { // FlatABox abox = FlatABox.getInstance(); int nr; int nrOfConcepts = learningProblem.getReasoningService().getAtomicConcepts().size(); @@ -501,16 +501,16 @@ nr = rand.nextInt(2+nrOfConcepts); if(nr==0) - return new Top(); + return new Thing(); else if(nr==1) - return new Bottom(); + return new Nothing(); // die Zahl kann nur vorkommen, wenn ADC aktiviert ist else if(nr==2+nrOfConcepts) { // System.out.println("== ADC 2 =="); return new ADC(); } else - return (AtomicConcept) learningProblem.getReasoningService().getAtomicConceptsList().get(nr-2).clone(); + return (NamedClass) learningProblem.getReasoningService().getAtomicConceptsList().get(nr-2).clone(); } // Funktion nach Umstelllung der Konstruktoren nicht mehr ben�tigt @@ -628,7 +628,7 @@ return createProgram(learningProblem, createFullRandomTree(learningProblem, depth, false)); } - private static Concept createFullRandomTree(LearningProblem learningProblem, int depth, boolean useADC) { + private static Description createFullRandomTree(LearningProblem learningProblem, int depth, boolean useADC) { // FlatABox abox = FlatABox.getInstance(); int numberOfRoles = learningProblem.getReasoningService().getAtomicRoles().size(); // abox.roles.size(); @@ -637,26 +637,26 @@ // System.out.println(nr); // Node node = createNonLeafNodeEqualProp(); // Concept node = pickFunctionSymbol(); - Concept child1 = createFullRandomTree(learningProblem, depth-1, useADC); + Description child1 = createFullRandomTree(learningProblem, depth-1, useADC); if(nr == 0 || nr == 1) { - Concept child2 = createFullRandomTree(learningProblem, depth-1, useADC); + Description child2 = createFullRandomTree(learningProblem, depth-1, useADC); if(nr == 0) { // if(useMultiStructures) - return new MultiDisjunction(child1,child2); + return new Union(child1,child2); // else // return new Disjunction(child1,child2); } else { // if(useMultiStructures) - return new MultiConjunction(child1, child2); + return new Intersection(child1, child2); // else // return new Conjunction(child1, child2); } } else if(nr==2) { return new Negation(child1); } else if(nr - 3 < numberOfRoles) - return new Exists(learningProblem.getReasoningService().getAtomicRolesList().get(nr-3),child1); + return new ObjectSomeRestriction(learningProblem.getReasoningService().getAtomicRolesList().get(nr-3),child1); else - return new All(learningProblem.getReasoningService().getAtomicRolesList().get(nr-3-numberOfRoles),child1); + return new ObjectAllRestriction(learningProblem.getReasoningService().getAtomicRolesList().get(nr-3-numberOfRoles),child1); /* if(node instanceof Disjunction || node instanceof Conjunction) { @@ -689,7 +689,7 @@ return createProgram(learningProblem, createGrowRandomTree(learningProblem, depth,false)); } - private static Concept createGrowRandomTree(LearningProblem learningProblem, int depth, boolean useADC) { + private static Description createGrowRandomTree(LearningProblem learningProblem, int depth, boolean useADC) { /* private static Concept pickAlphabetSymbol(boolean useADC) { FlatABox abox = FlatABox.getInstance(); @@ -761,30 +761,30 @@ // Concept node = pickAlphabetSymbol(useADC); if(nr==0) - return new Top(); + return new Thing(); else if(nr==1) - return new Bottom(); + return new Nothing(); // ADC bekommt die h�chste Nummer, die nur in diesem Fall m�glich ist else if(nr==numberOfConcepts + 2*numberOfRoles + 5) return new ADC(); else if(nr>=2 && nr < numberOfConcepts+2) - return (AtomicConcept)learningProblem.getReasoningService().getAtomicConceptsList().get(nr-2).clone(); + return (NamedClass)learningProblem.getReasoningService().getAtomicConceptsList().get(nr-2).clone(); else if(nr==numberOfConcepts+2) { // if(useMultiStructures) - return new MultiConjunction(createGrowRandomTree(learningProblem, depth-1, useADC),createGrowRandomTree(learningProblem, depth-1, useADC)); + return new Intersection(createGrowRandomTree(learningProblem, depth-1, useADC),createGrowRandomTree(learningProblem, depth-1, useADC)); // else // return new Conjunction(createGrowRandomTree(learningProblem, depth-1, useADC),createGrowRandomTree(learningProblem, depth-1, useADC)); } else if(nr==numberOfConcepts+3) { // if(useMultiStructures) - return new MultiDisjunction(createGrowRandomTree(learningProblem, depth-1, useADC),createGrowRandomTree(learningProblem, depth-1, useADC)); + return new Union(createGrowRandomTree(learningProblem, depth-1, useADC),createGrowRandomTree(learningProblem, depth-1, useADC)); // else // return new Disjunction(createGrowRandomTree(learningProblem, depth-1, useADC),createGrowRandomTree(learningProblem, depth-1, useADC)); } else if(nr==numberOfConcepts+4) return new Negation(createGrowRandomTree(learningProblem, depth-1, useADC)); else if(nr>=numberOfConcepts+5 && nr<numberOfConcepts+5+numberOfRoles) - return new Exists(learningProblem.getReasoningService().getAtomicRolesList().get(nr-numberOfConcepts-5),createGrowRandomTree(learningProblem,depth-1, useADC)); + return new ObjectSomeRestriction(learningProblem.getReasoningService().getAtomicRolesList().get(nr-numberOfConcepts-5),createGrowRandomTree(learningProblem,depth-1, useADC)); else - return new All(learningProblem.getReasoningService().getAtomicRolesList().get(nr-numberOfConcepts-5-numberOfRoles),createGrowRandomTree(learningProblem,depth-1, useADC)); + return new ObjectAllRestriction(learningProblem.getReasoningService().getAtomicRolesList().get(nr-numberOfConcepts-5-numberOfRoles),createGrowRandomTree(learningProblem,depth-1, useADC)); /* if(node instanceof Disjunction || node instanceof Conjunction) { @@ -812,14 +812,14 @@ return checkTree(prog.getTree(), true); } - public static boolean checkTree(Concept node, boolean isRootNode) { + public static boolean checkTree(Description node, boolean isRootNode) { if(isRootNode && node.getParent()!=null) { System.out.println("inconsistent root"); return false; } // Kinder �berpr�fen - for(Concept child : node.getChildren()) { + for(Description child : node.getChildren()) { if(!child.getParent().equals(node)) { System.out.println("inconsistent tree " + node + " (child " + child + ")"); return false; Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java 2008-02-11 18:50:44 UTC (rev 542) @@ -21,7 +21,7 @@ package org.dllearner.algorithms.gp; import org.dllearner.core.Score; -import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Description; /** * This class represents a program, i.e. an individual. @@ -33,11 +33,11 @@ // public static int fitnessEvaluations = 0; - private Concept hypothesis; + private Description hypothesis; // private Concept extendedHypothesis; - private Concept adc; + private Description adc; private Score score; @@ -53,11 +53,11 @@ * @param concept * The program tree. */ - public Program(Score score, Concept hypothesis) { + public Program(Score score, Description hypothesis) { this(score, hypothesis, null); } - public Program(Score score, Concept hypothesis, Concept adc) { + public Program(Score score, Description hypothesis, Description adc) { // this.learningProblem = learningProblem; this.score = score; this.hypothesis = hypothesis; @@ -126,7 +126,7 @@ * * @return The program tree. */ - public Concept getTree() { + public Description getTree() { return hypothesis; } @@ -134,7 +134,7 @@ return score; } - public Concept getAdc() { + public Description getAdc() { return adc; } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/Psi.java 2008-02-11 18:50:44 UTC (rev 542) @@ -7,7 +7,7 @@ import org.dllearner.algorithms.gp.Program; import org.dllearner.core.Score; -import org.dllearner.core.owl.Concept; +import org.dllearner.core.owl.Description; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.ConceptComparator; import org.dllearner.utilities.ConceptTransformation; @@ -23,12 +23,12 @@ // Cache, damit keine Konzepte doppelt ausgewertet werden ConceptComparator conceptComparator = new ConceptComparator(); - public SortedMap<Concept,Score> evalCache = new TreeMap<Concept,Score>(conceptComparator); + public SortedMap<Description,Score> evalCache = new TreeMap<Description,Score>(conceptComparator); // Cache, damit PsiDown bzw. PsiUp nicht mehrfach für gleiches Konzept // aufgerufen werden - public SortedMap<Concept,Set<Concept>> pdCache = new TreeMap<Concept,Set<Concept>>(conceptComparator); - public SortedMap<Concept,Set<Concept>> puCache = new TreeMap<Concept,Set<Concept>>(conceptComparator); + public SortedMap<Description,Set<Description>> pdCache = new TreeMap<Description,Set<Description>>(conceptComparator); + public SortedMap<Description,Set<Description>> puCache = new TreeMap<Description,Set<Description>>(conceptComparator); // Statistiken int conceptCacheHits = 0; @@ -57,7 +57,7 @@ random = new Random(); } - public Concept applyPsi(Concept concept, int coveredPositives, int coveredNegatives) { + public Description applyPsi(Description concept, int coveredPositives, int coveredNegatives) { // Wahrscheinlichkeit für upward refinement berechnen double tmp = coveredNegatives/(double)nrOfNegativeExamples; double tmp2 = coveredPositives/(double)nrOfPositiveExamples; @@ -92,7 +92,7 @@ // someTimeStart = System.nanoTime(); // downward oder upward refinement operator anwenden - Set<Concept> refinements; + Set<Description> refinements; if(downward) { pdRequests++; // Cache aufrufen @@ -137,7 +137,7 @@ // ein refinement zufällig auswählen - Concept[] array = refinements.toArray(new Concept[0]); + Description[] array = refinements.toArray(new Description[0]); // kein refinement gefunden if(array.length==0) { if(debug) { @@ -149,12 +149,12 @@ } int position = random.nextInt(array.length); - Concept returnConcept = array[position]; + Description returnConcept = array[position]; ConceptTransformation.cleanConcept(returnConcept); // das Rückgabekonzept wird geklont, damit alle parent-Links repariert // werden (damit andere GP-Operatoren korrekt funktionieren) - Concept returnConceptClone = (Concept)returnConcept.clone(); + Description returnConceptClone = (Description)returnConcept.clone(); returnConceptClone.setParent(null); if(debug) { @@ -169,7 +169,7 @@ psiApplicationStartTime = System.nanoTime(); nrOfRequests++; - Concept concept = program.getTree(); + Description concept = program.getTree(); // es muss sichergestellt sein, dass Konjunktionen nur als MultConjunctions // vorhanden sind (analog bei Disjunktion) => effizienter wäre eine Auslagerung // dieses Codes in die Konzepterzeugung, da die Transformation häufig nichts @@ -180,11 +180,11 @@ // sich lohnt Operatoren zu definieren, die keine Negationsnormalform // erfordern) - Concept conceptMod = ConceptTransformation.transformToNegationNormalForm(concept); + Description conceptMod = ConceptTransformation.transformToNegationNormalForm(concept); // um mehr Cache Hits zu bekommen, wird noch vereinfach und geordnet - Concept conceptModForCache = ConceptTransformation.applyEquivalenceRules(conceptMod); + Description conceptModForCache = ConceptTransformation.applyEquivalenceRules(conceptMod); ConceptTransformation.transformToOrderedNegationNormalForm(conceptModForCache, conceptComparator); Score score = program.getScore(); @@ -196,14 +196,14 @@ int coveredPositives = score.getCoveredPositives().size(); int coveredNegatives = score.getCoveredNegatives().size(); // someTimeStart = System.nanoTime(); - Concept newConcept = applyPsi(conceptMod, coveredPositives, coveredNegatives); + Description newConcept = applyPsi(conceptMod, coveredPositives, coveredNegatives); ConceptTransformation.cleanConcept(newConcept); // someTime += System.nanoTime() - someTimeStart; // newConcept.setParent(null); /////////// TESTCODE: umwandeln des erhaltenen Konzepts // someTimeStart = System.nanoTime(); - Concept newConceptMod = ConceptTransformation.applyEquivalenceRules(newConcept); + Description newConceptMod = ConceptTransformation.applyEquivalenceRules(newConcept); ConceptTransformation.transformToOrderedNegationNormalForm(newConceptMod, conceptComparator); // someTime += System.nanoTime() - someTimeStart; /////////// @@ -278,11 +278,11 @@ return puRequests; } - public SortedMap<Concept, Set<Concept>> getPdCache() { + public SortedMap<Description, Set<Description>> getPdCache() { return pdCache; } - public SortedMap<Concept, Set<Concept>> getPuCache() { + public SortedMap<Description, Set<Description>> getPuCache() { return puCache; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiDown.java 2008-02-11 18:50:44 UTC (rev 542) @@ -9,17 +9,17 @@ import org.dllearner.algorithms.refinement.RefinementOperator; import org.dllearner.core.ReasoningService; -import org.dllearner.core.owl.All; -import org.dllearner.core.owl.AtomicConcept; -import org.dllearner.core.owl.Bottom; -import org.dllearner.core.owl.Concept; -import org.dllearner.core.owl.Exists; -import org.dllearner.core.owl.MultiConjunction; -import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.ObjectAllRestriction; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.Union; import org.dllearner.core.owl.Negation; import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.Quantification; -import org.dllearner.core.owl.Top; +import org.dllearner.core.owl.ObjectQuantorRestriction; +import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.ConceptComparator; @@ -42,7 +42,7 @@ PosNegLP learningProblem; ReasoningService reasoningService; - private TreeSet<Concept> topSet; + private TreeSet<Description> topSet; public PsiDown(PosNegLP learningProblem) { this.learningProblem = learningProblem; @@ -53,140 +53,140 @@ } private void createTopSet() { - topSet = new TreeSet<Concept>(conceptComparator); + topSet = new TreeSet<Description>(conceptComparator); // TOP OR TOP => Was soll mit Refinements passieren, die immer improper sind? - MultiDisjunction md = new MultiDisjunction(); - md.addChild(new Top()); - md.addChild(new Top()); + Union md = new Union(); + md.addChild(new Thing()); + md.addChild(new Thing()); topSet.add(md); // allgemeinste Konzepte - topSet.addAll(reasoningService.getMoreSpecialConcepts(new Top())); + topSet.addAll(reasoningService.getMoreSpecialConcepts(new Thing())); // negierte speziellste Konzepte - Set<Concept> tmp = learningProblem.getReasoningService().getMoreGeneralConcepts(new Bottom()); - for(Concept c : tmp) + Set<Description> tmp = learningProblem.getReasoningService().getMoreGeneralConcepts(new Nothing()); + for(Description c : tmp) topSet.add(new Negation(c)); // EXISTS r.TOP und ALL r.TOP für alle r for(ObjectProperty r : reasoningService.getAtomicRoles()) { - topSet.add(new All(r, new Top())); - topSet.add(new Exists(r, new Top())); + topSet.add(new ObjectAllRestriction(r, new Thing())); + topSet.add(new ObjectSomeRestriction(r, new Thing())); } } @SuppressWarnings("unchecked") - public Set<Concept> refine(Concept concept) { + public Set<Description> refine(Description concept) { - Set<Concept> refinements = new HashSet<Concept>(); - Set<Concept> tmp = new HashSet<Concept>(); + Set<Description> refinements = new HashSet<Description>(); + Set<Description> tmp = new HashSet<Description>(); - if (concept instanceof Top) { - return (Set<Concept>) topSet.clone(); - } else if (concept instanceof Bottom) { + if (concept instanceof Thing) { + return (Set<Description>) topSet.clone(); + } else if (concept instanceof Nothing) { // return new TreeSet<Concept>(conceptComparator); - return new HashSet<Concept>(); - } else if (concept instanceof AtomicConcept) { + return new HashSet<Description>(); + } else if (concept instanceof NamedClass) { // beachte: die Funktion gibt bereits nur nicht-äquivalente Konzepte zurück // beachte weiter: die zurückgegebenen Instanzen dürfen nicht verändert werden, // da beim Caching der Subsumptionhierarchie (momentan) keine Kopien gemacht werden // Bottom wird hier ggf. automatisch mit zurückgegeben refinements.addAll(reasoningService.getMoreSpecialConcepts(concept)); // negiertes atomares Konzept - } else if (concept instanceof Negation && concept.getChild(0) instanceof AtomicConcept) { + } else if (concept instanceof Negation && concept.getChild(0) instanceof NamedClass) { tmp.addAll(reasoningService.getMoreGeneralConcepts(concept.getChild(0))); // Top rausschmeissen boolean containsTop = false; - Iterator<Concept> it = tmp.iterator(); + Iterator<Description> it = tmp.iterator(); while(it.hasNext()) { - Concept c = it.next(); - if(c instanceof Top) { + Description c = it.next(); + if(c instanceof Thing) { it.remove(); containsTop = true; } } if(containsTop) - refinements.add(new Bottom()); + refinements.add(new Nothing()); - for(Concept c : tmp) { + for(Description c : tmp) { refinements.add(new Negation(c)); } - } else if (concept instanceof MultiConjunction) { + } else if (concept instanceof Intersection) { // eines der Elemente kann verfeinert werden - for(Concept child : concept.getChildren()) { + for(Description child : concept.getChildren()) { // Refinement für das Kind ausführen tmp = refine(child); // neue MultiConjunction konstruieren - for(Concept c : tmp) { + for(Description c : tmp) { // TODO: müssen auch alle Konzepte geklont werden?? // hier wird nur eine neue Liste erstellt // => eigentlich muss nicht geklont werden (d.h. deep copy) da // die Konzepte nicht verändert werden während des Algorithmus - List<Concept> newChildren = new LinkedList<Concept>(concept.getChildren()); + List<Description> newChildren = new LinkedList<Description>(concept.getChildren()); // es muss genau die vorherige Reihenfolge erhalten bleiben // (zumindest bis die Normalform definiert ist) int index = newChildren.indexOf(child); newChildren.add(index, c); newChildren.remove(child); - MultiConjunction mc = new MultiConjunction(newChildren); + Intersection mc = new Intersection(newChildren); refinements.add(mc); } } - } else if (concept instanceof MultiDisjunction) { + } else if (concept instanceof Union) { // eines der Elemente kann verfeinert werden - for(Concept child : concept.getChildren()) { + for(Description child : concept.getChildren()) { // Refinement für das Kind ausführen // tmp = refine(child); tmp = refine(child); // neue MultiConjunction konstruieren - for(Concept c : tmp) { - List<Concept> newChildren = new LinkedList<Concept>(concept.getChildren()); + for(Description c : tmp) { + List<Description> newChildren = new LinkedList<Description>(concept.getChildren()); // es muss genau die vorherige Reihenfolge erhalten bleiben // (zumindest bis die Normalform definiert ist) int index = newChildren.indexOf(child); newChildren.add(index, c); newChildren.remove(child); - MultiDisjunction md = new MultiDisjunction(newChildren); + Union md = new Union(newChildren); refinements.add(md); } } // ein Element der Disjunktion kann weggelassen werden - for(Concept child : concept.getChildren()) { - List<Concept> newChildren = new LinkedList<Concept>(concept.getChildren()); + for(Description child : concept.getChildren()) { + List<Description> newChildren = new LinkedList<Description>(concept.getChildren()); newChildren.remove(child); // wenn nur ein Kind da ist, dann wird Disjunktion gleich weggelassen if(newChildren.size()==1) refinements.add(newChildren.get(0)); else { - MultiDisjunction md = new MultiDisjunction(newChildren); + Union md = new Union(newChildren); refinements.add(md); } } - } else if (concept instanceof Exists) { + } else if (concept instanceof ObjectSomeRestriction) { tmp = refine(concept.getChild(0)); - for(Concept c : tmp) { - refinements.add(new Exists(((Quantification)concept).getRole(),c)); + for(Description c : tmp) { + refinements.add(new ObjectSomeRestriction(((ObjectQuantorRestriction)concept).getRole(),c)); } // falls Kind Bottom ist, dann kann exists weggelassen werden - if(concept.getChild(0) instanceof Bottom) - refinements.add(new Bottom()); + if(concept.getChild(0) instanceof Nothing) + refinements.add(new Nothing()); - } else if (concept instanceof All) { + } else if (concept instanceof ObjectAllRestriction) { tmp = refine(concept.getChild(0)); - for(Concept c : tmp) { - refinements.add(new All(((Quantification)concept).getRole(),c)); + for(Description c : tmp) { + refinements.add(new ObjectAllRestriction(((ObjectQuantorRestriction)concept).getRole(),c)); } - if(concept.getChild(0) instanceof Bottom) - refinements.add(new Bottom()); + if(concept.getChild(0) instanceof Nothing) + refinements.add(new Nothing()); // falls es keine spezielleren atomaren Konzepte gibt, dann wird // bottom angehangen => nur wenn es ein atomares Konzept (insbesondere != bottom) @@ -200,13 +200,13 @@ // falls Konzept ungleich Bottom oder Top, dann kann ein Refinement von Top // angehangen werden - if(concept instanceof MultiDisjunction || concept instanceof AtomicConcept || - concept instanceof Negation || concept instanceof Exists || concept instanceof All) { + if(concept instanceof Union || concept instanceof NamedClass || + concept instanceof Negation || concept instanceof ObjectSomeRestriction || concept instanceof ObjectAllRestriction) { // es wird AND TOP angehangen - MultiConjunction mc = new MultiConjunction(); + Intersection mc = new Intersection(); mc.addChild(concept); - mc.addChild(new Top()); + mc.addChild(new Thing()); refinements.add(mc); } @@ -237,8 +237,8 @@ } - public Set<Concept> refine(Concept concept, int maxLength, - List<Concept> knownRefinements) { + public Set<Description> refine(Description concept, int maxLength, + List<Description> knownRefinements) { throw new RuntimeException(); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java 2008-02-11 17:41:10 UTC (rev 541) +++ trunk/src/dl-learner/org/dllearner/algorithms/hybridgp/PsiUp.java 2008-02-11 18:50:44 UTC (rev 542) @@ -9,17 +9,17 @@ import org.dllearner.algorithms.refinement.RefinementOperator; import org.dllearner.core.ReasoningService; -import org.dllearner.core.owl.All; -import org.dllearner.core.owl.AtomicConcept; -import org.dllearner.core.owl.Bottom; -import org.dllearner.core.owl.Concept; -import org.dllearner.core.owl.Exists; -import org.dllearner.core.owl.MultiConjunction; -import org.dllearner.core.owl.MultiDisjunction; +import org.dllearner.core.owl.ObjectAllRestriction; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.Union; import org.dllearner.core.owl.Negation; import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.Quantification; -import org.dllearner.core.owl.Top; +import org.dllearner.core.owl.ObjectQuantorRestriction; +import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.utilities.ConceptComparator; @@ -30,7 +30,7 @@ PosNegLP learningProblem; ReasoningService reasoningService; - private TreeSet<Concept> bottomSet; + private TreeSet<Description> bottomSet; public PsiUp(PosNegLP learningProblem) { this.learningProblem = learningProblem; @@ -41,53 +41,53 @@ } private void createBottomSet() { - bottomSet = new TreeSet<Concept>(conceptComparator); + bottomSet = new TreeSet<Description>(conceptComparator); // BOTTOM AND BOTTOM - MultiConjunction mc = new MultiConjunction(); - mc.addChild(new Bottom()); - mc.addChild(new Bottom()); + Intersection mc = new Intersection(); + mc.addChild(new Nothing()); + mc.addChild(new Nothing()); bottomSet.add(mc); // speziellste Konzepte - bottomSet.addAll(reasoningService.getMoreGeneralConcepts(new Bottom())); + bottomSet.addAll(reasoningService.getMoreGeneralConcepts(new Nothing())); // negierte allgemeinste Konzepte - Set<Concept> tmp = reasoningService.getMoreSpecialConcepts(new Top()); - for(Concept c : tmp) + Set<Description> tmp = reasoningService.getMoreSpecialConcepts(new Thing()); + for(Description c : tmp) bottomSet.add(new Negation(c)); // EXISTS r.BOTTOM und ALL r.BOTTOM für alle r for(ObjectProperty r : reasoningService.getAtomicRoles()) { - bottomSet.add(new All(r, new Bottom())); - bottomSet.add(new Exists(r, new Bottom())); + bottomSet.add(new ObjectAllRestriction(r, new Nothing())); + bottomSet.add(new ObjectSomeRestriction(r, new Nothing())); } } @SuppressWarnings("unchecked") - public Set<Concept> refine(Concept concept) { + public Set<Description> refine(Description concept) { - Set<Concept> refinements = new HashSet<Concept>(); - Set<Concept> tmp = new HashSet<Concept>(); + Set<Description> refinements = new HashSet<Description>(); + Set<Description> tmp = new HashSet<Description>(); - if (concept instanceof Top) { - return new TreeSet<Concept>(conceptComparator); - } else if (concept instanceof Bottom) { - return (Set<Concept>) bottomSet.clone(); - } else if (concept instanceof AtomicConcept) { + if (concept instanceof Thing) { + return new TreeSet<Description>(conceptComparator); + } else if (concept instanceof Nothing) { + return (Set<Description>) bottomSet.clone(); + } else if (concept instanceof NamedClass) { // Top darf hier mit dabei sein refinements.addAll(reasoningService.getMoreGeneralConcepts(concept)); // negiertes atomares Konzept - } else if (concept instanceof Negation && concept.getChild(0) instanceof AtomicConcept) { + } else if (concept instanceof Negation && concept.getChild(0) instanceof NamedClass) { tmp.addAll(reasoningService.getMoreSpecialConcepts(concept.getChild(0))); // Bottom rausschmeissen boolean containsBottom = false; - Iterator<Concept> it = tmp.iterator(); + Iterator<Description> it = tmp.iterator(); while(it.hasNext()) { - Concept c = it.next(); - if(c instanceof Bottom) { + Description c = it.next(); + if(c instanceof Nothing) { it.remove(); containsBottom = true; } @@ -95,82 +95,82 @@ // es soll z.B. NOT male auch zu NOT BOTTOM d.h. zu TOP verfeinert // werden können if(containsBottom) - refinements.add(new Top()); + refinements.add(new Thing()); - for(Concept c : tmp) { + for(Description c : tmp) { refinements.add(new Negation(c)); } - } else if (concept instanceof MultiConjunction) { + } else if (concept instanceof Intersection) { // eines der Elemente kann verfeinert werden - for(Concept child : concept.getChildren()) { + for(Description child : concept.getChildren()) { // Refinement für das Kind ausführen tmp = refine(child); // neue MultiConjunction konstruieren - for(Concept c : tmp) { + for(Description c : tmp) { // TODO: müssen auch alle Konzepte geklont werden?? // hier wird nur eine neue Liste erstellt // => eigentlich muss nicht geklont werden (d.h. deep copy) da // die Konzepte nicht verändert werden während des Algorithmus - List<Concept> newChildren = new LinkedList<Concept>(concept.getChildren()); + List<Description> newChildren = new LinkedList<Description>(concept.getChildren()); // es muss genau die vorherige Reihenfolge erhalten bleiben // (zumindest bis die Normalform definiert ist) int index = newChildren.indexOf(child); newChildren.add(index, c); newChildren.remove(child); - MultiConjunction mc = new MultiConjunction(... [truncated message content] |
From: <jen...@us...> - 2008-02-11 19:01:58
|
Revision: 543 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=543&view=rev Author: jenslehmann Date: 2008-02-11 11:01:36 -0800 (Mon, 11 Feb 2008) Log Message: ----------- - wrote visitor interfaces for OWL structures - more structures added Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiomVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpressionVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiomVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java Added: trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiomVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiomVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiomVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Visitor for assertional (ABox) axioms. + * + * @author Jens Lehmann + * + */ +public interface AssertionalAxiomVisitor { + + public void visit(ClassAssertionAxiom axiom); + + public void visit(ObjectPropertyAssertion axiom); + + public void visit(DoubleDatatypePropertyAssertion axiom); + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Visitor interface for all implemented kinds of axioms in a knowledge + * base. + * + * @author Jens Lehmann + * + */ +public interface AxiomVisitor extends AssertionalAxiomVisitor, PropertyAxiomVisitor, TerminologicalAxiomVisitor { + + + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class CardinalityRestriction extends Description { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeCardinalityRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeCardinalityRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class DatatypeCardinalityRestriction extends CardinalityRestriction { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class DatatypeExactCardinalityRestriction extends DatatypeCardinalityRestriction { + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Concept#getArity() + */ + @Override + public int getArity() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class DatatypeMaxCardinalityRestriction extends DatatypeCardinalityRestriction { + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Concept#getArity() + */ + @Override + public int getArity() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class DatatypeMinCardinalityRestriction extends DatatypeCardinalityRestriction { + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Concept#getArity() + */ + @Override + public int getArity() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public class DatatypeValueRestriction extends ValueRestriction { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Visitor for elements in complex class descriptions (it supports + * the currently relevant ones - needs to be extended when further + * constructs are needed). + * + * @author Jens Lehmann + * + */ +public interface DescriptionVisitor { + + public void visit(Negation description); + + public void visit(ObjectAllRestriction description); + + public void visit(ObjectSomeRestriction description); + + public void visit(Nothing description); + + public void visit(Thing description); + + public void visit(Intersection description); + + public void visit(Union description); + + public void visit(ObjectMinCardinalityRestriction description); + + public void visit(ObjectExactCardinalityRestriction description); + + public void visit(ObjectMaxCardinalityRestriction description); + + public void visit(ObjectValueRestriction description); + + public void visit(DatatypeValueRestriction description); +} Added: trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Visitor for all elements of a knowledge base. + * + * @author Jens Lehmann + * + */ +public interface KBElementVisitor extends AxiomVisitor, DescriptionVisitor, PropertyExpressionVisitor { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class ObjectExactCardinalityRestriction extends ObjectCardinalityRestriction { + + public ObjectExactCardinalityRestriction(int number, ObjectPropertyExpression role, Description c) { + super(number,role,c); + } + + @Override + public int getArity() { + return 1; + } + + public String toString(String baseURI, Map<String,String> prefixes) { + return "= " + number + " " + role.toString(baseURI, prefixes) + " " + getChild(0).toString(baseURI, prefixes); + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public class ObjectValueRestriction extends ValueRestriction { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Visitor for property (RBox) axioms. + * + * @author Jens Lehmann + * + */ +public interface PropertyAxiomVisitor { + + public void visit(FunctionalObjectPropertyAxiom axiom); + + public void visit(InverseObjectPropertyAxiom axiom); + + public void visit(SymmetricObjectPropertyAxiom axiom); + + public void visit(TransitiveObjectPropertyAxiom axiom); +} Added: trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpressionVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpressionVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpressionVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * A visitor for property expression, which can occur in class + * descriptions. + * + * @author Jens Lehmann + * + */ +public interface PropertyExpressionVisitor { + + public void visit(ObjectProperty property); + + public void visit(ObjectPropertyInverse property); + + public void visit(DatatypeProperty property); +} Added: trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiomVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiomVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiomVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public interface TerminologicalAxiomVisitor { + + public void visit(EquivalentClassesAxiom axiom); + + public void visit(SubClassAxiom axiom); + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class ValueRestriction extends Description { + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Concept#getArity() + */ + @Override + public int getArity() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + +} Added: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java 2008-02-11 19:01:36 UTC (rev 543) @@ -0,0 +1,284 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.reasoning; + +import java.net.URI; + +import org.dllearner.core.owl.ClassAssertionAxiom; +import org.dllearner.core.owl.DatatypeProperty; +import org.dllearner.core.owl.DatatypeValueRestriction; +import org.dllearner.core.owl.DoubleDatatypePropertyAssertion; +import org.dllearner.core.owl.EquivalentClassesAxiom; +import org.dllearner.core.owl.FunctionalObjectPropertyAxiom; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.InverseObjectPropertyAxiom; +import org.dllearner.core.owl.KB; +import org.dllearner.core.owl.KBElementVisitor; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.ObjectAllRestriction; +import org.dllearner.core.owl.ObjectExactCardinalityRestriction; +import org.dllearner.core.owl.ObjectMaxCardinalityRestriction; +import org.dllearner.core.owl.ObjectMinCardinalityRestriction; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectPropertyAssertion; +import org.dllearner.core.owl.ObjectPropertyInverse; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.ObjectValueRestriction; +import org.dllearner.core.owl.SubClassAxiom; +import org.dllearner.core.owl.SymmetricObjectPropertyAxiom; +import org.dllearner.core.owl.Thing; +import org.dllearner.core.owl.TransitiveObjectPropertyAxiom; +import org.dllearner.core.owl.Union; +import org.semanticweb.owl.model.AddAxiom; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLObjectProperty; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyManager; + +/** + * A converter from DL-Learner format to OWL API format. + * + * @author Jens Lehmann + * + */ +public class OWLAPIConverterVisitor implements KBElementVisitor { + + OWLDataFactory factory; + private OWLOntology ontology; + private OWLOntologyManager manager; + + public OWLAPIConverterVisitor(OWLOntologyManager manager, OWLOntology ontology, KB kb) { + this.manager = manager; + this.ontology = ontology; + factory = manager.getOWLDataFactory(); + } + + private void addAxiom(OWLAxiom axiom) { + AddAxiom addAxiom = new AddAxiom(ontology, axiom); + try { + manager.applyChange(addAxiom); + } catch (OWLOntologyChangeException e) { + e.printStackTrace(); + } + } + + /* (non-Javadoc) + * @see org.dllearner.core.dl.AxiomVisitor#visit(org.dllearner.core.dl.ObjectPropertyAssertion) + */ + public void visit(ObjectPropertyAssertion axiom) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(((ObjectPropertyAssertion) axiom).getRole().getName())); + OWLIndividual i1 = factory.getOWLIndividual( + URI.create(((ObjectPropertyAssertion) axiom).getIndividual1().getName())); + OWLIndividual i2 = factory.getOWLIndividual( + URI.create(((ObjectPropertyAssertion) axiom).getIndividual2().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLObjectPropertyAssertionAxiom(i1, role, i2); + addAxiom(axiomOWLAPI); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.AssertionalAxiomVisitor#visit(org.dllearner.core.owl.ClassAssertionAxiom) + */ + public void visit(ClassAssertionAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.AssertionalAxiomVisitor#visit(org.dllearner.core.owl.DoubleDatatypePropertyAssertion) + */ + public void visit(DoubleDatatypePropertyAssertion axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.FunctionalObjectPropertyAxiom) + */ + public void visit(FunctionalObjectPropertyAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.InverseObjectPropertyAxiom) + */ + public void visit(InverseObjectPropertyAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.SymmetricObjectPropertyAxiom) + */ + public void visit(SymmetricObjectPropertyAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.TransitiveObjectPropertyAxiom) + */ + public void visit(TransitiveObjectPropertyAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.TerminologicalAxiomVisitor#visit(org.dllearner.core.owl.EquivalentClassesAxiom) + */ + public void visit(EquivalentClassesAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.TerminologicalAxiomVisitor#visit(org.dllearner.core.owl.SubClassAxiom) + */ + public void visit(SubClassAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Negation) + */ + public void visit(Negation description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectAllRestriction) + */ + public void visit(ObjectAllRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectSomeRestriction) + */ + public void visit(ObjectSomeRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Nothing) + */ + public void visit(Nothing description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Thing) + */ + public void visit(Thing description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Intersection) + */ + public void visit(Intersection description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Union) + */ + public void visit(Union description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectMinCardinalityRestriction) + */ + public void visit(ObjectMinCardinalityRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectExactCardinalityRestriction) + */ + public void visit(ObjectExactCardinalityRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectMaxCardinalityRestriction) + */ + public void visit(ObjectMaxCardinalityRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectValueRestriction) + */ + public void visit(ObjectValueRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.DatatypeValueRestriction) + */ + public void visit(DatatypeValueRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyExpressionVisitor#visit(org.dllearner.core.owl.ObjectProperty) + */ + public void visit(ObjectProperty property) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyExpressionVisitor#visit(org.dllearner.core.owl.ObjectPropertyInverse) + */ + public void visit(ObjectPropertyInverse property) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyExpressionVisitor#visit(org.dllearner.core.owl.DatatypeProperty) + */ + public void visit(DatatypeProperty property) { + // TODO Auto-generated method stub + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-12 09:20:08
|
Revision: 545 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=545&view=rev Author: jenslehmann Date: 2008-02-12 01:20:06 -0800 (Tue, 12 Feb 2008) Log Message: ----------- - added more OWL structures, in particular datatype some-restrictions and data ranges - continued visitor pattern - implemented DL-Learner to OWL API converter using visitors Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/Description.java trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java trunk/src/dl-learner/org/dllearner/core/owl/Negation.java trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyExpression.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectQuantorRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/Thing.java trunk/src/dl-learner/org/dllearner/core/owl/Union.java trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/package.html trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleDataRange.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpression.java trunk/src/dl-learner/org/dllearner/core/owl/QuantorRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/Restriction.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIDescriptionConvertVisitor.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-12 09:20:06 UTC (rev 545) @@ -3,6 +3,7 @@ import java.util.Map; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.DescriptionVisitor; public class ADC extends Description { @@ -29,4 +30,13 @@ public int getArity() { return 0; } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } + } Added: trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public class BooleanDataRange extends DataRange { + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/CardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -23,6 +23,6 @@ * @author Jens Lehmann * */ -public abstract class CardinalityRestriction extends Description { +public abstract class CardinalityRestriction extends Restriction { } Added: trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class DataRange { + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -51,5 +51,13 @@ // TODO Auto-generated method stub return null; } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -52,4 +52,11 @@ return null; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -52,4 +52,11 @@ return null; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-02-12 09:20:06 UTC (rev 545) @@ -27,7 +27,7 @@ * @author Jens Lehmann * */ -public class DatatypeProperty implements Property { +public class DatatypeProperty extends PropertyExpression implements Property { protected String name; Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class DatatypeQuantorRestriction extends QuantorRestriction { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,70 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * This class represents restrictions on datatypes, such as + * Man AND EXISTS hasAge >= 18. + * + * TODO: connect this with a data range and a datatype property + * + * @author Jens Lehmann + * + */ +public class DatatypeSomeRestriction extends DatatypeQuantorRestriction { + + + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#getArity() + */ + @Override + public int getArity() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -25,4 +25,11 @@ */ public class DatatypeValueRestriction extends ValueRestriction { + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Description.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Description.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/Description.java 2008-02-12 09:20:06 UTC (rev 545) @@ -274,5 +274,6 @@ public String toString() { return toString(null, null); } - + + public abstract void accept(DescriptionVisitor visitor); } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java 2008-02-12 09:20:06 UTC (rev 545) @@ -19,6 +19,8 @@ */ package org.dllearner.core.owl; +import org.dllearner.algorithms.gp.ADC; + /** * Visitor for elements in complex class descriptions (it supports * the currently relevant ones - needs to be extended when further @@ -28,13 +30,19 @@ * */ public interface DescriptionVisitor { - + + public void visit(NamedClass description); + + public void visit(ADC description); + public void visit(Negation description); public void visit(ObjectAllRestriction description); public void visit(ObjectSomeRestriction description); + public void visit(DatatypeSomeRestriction description); + public void visit(Nothing description); public void visit(Thing description); @@ -51,5 +59,12 @@ public void visit(ObjectValueRestriction description); + public void visit(DatatypeMinCardinalityRestriction description); + + public void visit(DatatypeExactCardinalityRestriction description); + + public void visit(DatatypeMaxCardinalityRestriction description); + public void visit(DatatypeValueRestriction description); + } Added: trunk/src/dl-learner/org/dllearner/core/owl/DoubleDataRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleDataRange.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleDataRange.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Ranges of type double for use in datatye restrictions. + * + * @author Jens Lehmann + * + */ +public abstract class DoubleDataRange extends DataRange { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Double data range restricted by a maximum value, e.g. + * hasAge <= 65. + * + * @author Jens Lehmann + * + */ +public class DoubleMaxValue extends DoubleDataRange { + + private double value; + + public DoubleMaxValue(double value) { + this.value = value; + } + + /** + * @return The maximum value. + */ + public double getValue() { + return value; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Double data range restricted by a maximum value, e.g. + * hasAge >= 18. + * + * @author Jens Lehmann + * + */ +public class DoubleMinValue extends DoubleDataRange { + + private double value; + + public DoubleMinValue(double value) { + this.value = value; + } + + /** + * @return The maximum value. + */ + public double getValue() { + return value; + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java 2008-02-12 09:20:06 UTC (rev 545) @@ -55,4 +55,11 @@ return ret; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-02-12 09:20:06 UTC (rev 545) @@ -60,4 +60,11 @@ return Helper.getAbbreviatedString(name, baseURI, prefixes); } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Negation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Negation.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/Negation.java 2008-02-12 09:20:06 UTC (rev 545) @@ -31,4 +31,11 @@ return 1; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java 2008-02-12 09:20:06 UTC (rev 545) @@ -26,4 +26,12 @@ public int getArity() { return 0; } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -96,4 +96,11 @@ } */ + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectCardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectCardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -1,6 +1,6 @@ package org.dllearner.core.owl; -public abstract class ObjectCardinalityRestriction extends Description { +public abstract class ObjectCardinalityRestriction extends CardinalityRestriction { protected ObjectPropertyExpression role; protected int number; Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -40,4 +40,11 @@ return "= " + number + " " + role.toString(baseURI, prefixes) + " " + getChild(0).toString(baseURI, prefixes); } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -16,4 +16,12 @@ public String toString(String baseURI, Map<String,String> prefixes) { return "<= " + number + " " + role.toString(baseURI, prefixes) + " " + getChild(0).toString(baseURI, prefixes); } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -16,4 +16,12 @@ public String toString(String baseURI, Map<String,String> prefixes) { return ">= " + number + " " + role.toString(baseURI, prefixes) + " " + getChild(0).toString(baseURI, prefixes); } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyExpression.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyExpression.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyExpression.java 2008-02-12 09:20:06 UTC (rev 545) @@ -27,7 +27,7 @@ * @author Jens Lehmann * */ -public abstract class ObjectPropertyExpression implements KBElement { +public abstract class ObjectPropertyExpression extends PropertyExpression implements KBElement { protected String name; Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectQuantorRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectQuantorRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectQuantorRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -1,6 +1,6 @@ package org.dllearner.core.owl; -public abstract class ObjectQuantorRestriction extends Description { +public abstract class ObjectQuantorRestriction extends QuantorRestriction { ObjectPropertyExpression role; Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -95,5 +95,13 @@ public int getLength() { return 2; } - */ + */ + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -25,4 +25,12 @@ */ public class ObjectValueRestriction extends ValueRestriction { + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } + } Added: trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpression.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpression.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyExpression.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class PropertyExpression implements KBElement { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/QuantorRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/QuantorRestriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/QuantorRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class QuantorRestriction extends Restriction { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/Restriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Restriction.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/Restriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class Restriction extends Description { + + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/Thing.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Thing.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/Thing.java 2008-02-12 09:20:06 UTC (rev 545) @@ -23,5 +23,13 @@ @Override public int getArity() { return 0; - } + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Union.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Union.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/Union.java 2008-02-12 09:20:06 UTC (rev 545) @@ -57,4 +57,12 @@ return ret; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) + */ + @Override + public void accept(DescriptionVisitor visitor) { + visitor.visit(this); + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ValueRestriction.java 2008-02-12 09:20:06 UTC (rev 545) @@ -25,7 +25,7 @@ * @author Jens Lehmann * */ -public class ValueRestriction extends Description { +public abstract class ValueRestriction extends Description { /* (non-Javadoc) * @see org.dllearner.core.owl.Concept#getArity() Modified: trunk/src/dl-learner/org/dllearner/core/owl/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/package.html 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/core/owl/package.html 2008-02-12 09:20:06 UTC (rev 545) @@ -2,6 +2,6 @@ <html> <head></head> <body bgcolor="white"> -<p>Classes for representing Description Logic constructs.</p> +<p>Classes for representing OWL constructs.</p> </body> </html> \ No newline at end of file Copied: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java (from rev 543, trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,209 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.reasoning; + +import java.net.URI; +import java.util.HashSet; +import java.util.Set; + +import org.dllearner.core.owl.AxiomVisitor; +import org.dllearner.core.owl.ClassAssertionAxiom; +import org.dllearner.core.owl.DoubleDatatypePropertyAssertion; +import org.dllearner.core.owl.EquivalentClassesAxiom; +import org.dllearner.core.owl.FunctionalObjectPropertyAxiom; +import org.dllearner.core.owl.InverseObjectPropertyAxiom; +import org.dllearner.core.owl.KB; +import org.dllearner.core.owl.ObjectPropertyAssertion; +import org.dllearner.core.owl.SubClassAxiom; +import org.dllearner.core.owl.SymmetricObjectPropertyAxiom; +import org.dllearner.core.owl.TransitiveObjectPropertyAxiom; +import org.semanticweb.owl.model.AddAxiom; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLObjectProperty; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyManager; + +// static import for easy access to the description converter +import static org.dllearner.reasoning.OWLAPIDescriptionConvertVisitor.getOWLDescription; + +/** + * A converter from DL-Learner axioms to OWL API axioms based on the visitor + * pattern. + * + * TODO: Investigate whether OWLOntologyManager and OWLOntology should be + * removed as parameters. It would be natural to have a DL-Learner KB as input + * and an OWL API OWLOntology as output. + * + * @author Jens Lehmann + * + */ +public class OWLAPIAxiomConvertVisitor implements AxiomVisitor { + + OWLDataFactory factory; + private OWLOntology ontology; + private OWLOntologyManager manager; + + public OWLAPIAxiomConvertVisitor(OWLOntologyManager manager, OWLOntology ontology, KB kb) { + this.manager = manager; + this.ontology = ontology; + factory = manager.getOWLDataFactory(); + } + + public static void fillOWLOntology(OWLOntologyManager manager, OWLOntology ontology, KB kb) { + // OWLAPIAxiomConvertVisitor converter = new OWLAPIAxiomConvertVisitor(manager, ontology, kb); + // for(Axiom axiom : kb.getTbox()) + // axiom.accept(this); + // return converter.getOWLDescription(); + } + + // convencience function for adding an axiom to the ontology + private void addAxiom(OWLAxiom axiom) { + AddAxiom addAxiom = new AddAxiom(ontology, axiom); + try { + manager.applyChange(addAxiom); + } catch (OWLOntologyChangeException e) { + e.printStackTrace(); + } + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.dl.AxiomVisitor#visit(org.dllearner.core.dl.ObjectPropertyAssertion) + */ + public void visit(ObjectPropertyAssertion axiom) { + OWLObjectProperty role = factory.getOWLObjectProperty(URI + .create(((ObjectPropertyAssertion) axiom).getRole().getName())); + OWLIndividual i1 = factory.getOWLIndividual(URI.create(((ObjectPropertyAssertion) axiom) + .getIndividual1().getName())); + OWLIndividual i2 = factory.getOWLIndividual(URI.create(((ObjectPropertyAssertion) axiom) + .getIndividual2().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLObjectPropertyAssertionAxiom(i1, role, i2); + addAxiom(axiomOWLAPI); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.AssertionalAxiomVisitor#visit(org.dllearner.core.owl.ClassAssertionAxiom) + */ + public void visit(ClassAssertionAxiom axiom) { + OWLDescription d = getOWLDescription(axiom.getConcept()); + OWLIndividual i = factory.getOWLIndividual(URI.create(((ClassAssertionAxiom) axiom) + .getIndividual().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLClassAssertionAxiom(i, d); + addAxiom(axiomOWLAPI); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.AssertionalAxiomVisitor#visit(org.dllearner.core.owl.DoubleDatatypePropertyAssertion) + */ + public void visit(DoubleDatatypePropertyAssertion axiom) { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.FunctionalObjectPropertyAxiom) + */ + public void visit(FunctionalObjectPropertyAxiom axiom) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(((FunctionalObjectPropertyAxiom) axiom).getRole().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLFunctionalObjectPropertyAxiom(role); + addAxiom(axiomOWLAPI); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.InverseObjectPropertyAxiom) + */ + public void visit(InverseObjectPropertyAxiom axiom) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(((InverseObjectPropertyAxiom) axiom).getRole().getName())); + OWLObjectProperty inverseRole = factory.getOWLObjectProperty( + URI.create(((InverseObjectPropertyAxiom) axiom).getInverseRole().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLInverseObjectPropertiesAxiom(role, inverseRole); + addAxiom(axiomOWLAPI); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.SymmetricObjectPropertyAxiom) + */ + public void visit(SymmetricObjectPropertyAxiom axiom) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(((SymmetricObjectPropertyAxiom) axiom).getRole().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLSymmetricObjectPropertyAxiom(role); + addAxiom(axiomOWLAPI); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.TransitiveObjectPropertyAxiom) + */ + public void visit(TransitiveObjectPropertyAxiom axiom) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(axiom.getRole().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLTransitiveObjectPropertyAxiom(role); + addAxiom(axiomOWLAPI); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.TerminologicalAxiomVisitor#visit(org.dllearner.core.owl.EquivalentClassesAxiom) + */ + public void visit(EquivalentClassesAxiom axiom) { + OWLDescription d1 = getOWLDescription(axiom.getConcept1()); + OWLDescription d2 = getOWLDescription(axiom.getConcept2()); + Set<OWLDescription> ds = new HashSet<OWLDescription>(); + ds.add(d1); + ds.add(d2); + OWLAxiom axiomOWLAPI = factory.getOWLEquivalentClassesAxiom(ds); + addAxiom(axiomOWLAPI); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.owl.TerminologicalAxiomVisitor#visit(org.dllearner.core.owl.SubClassAxiom) + */ + public void visit(SubClassAxiom axiom) { + OWLDescription d1 = getOWLDescription(axiom.getSubConcept()); + OWLDescription d2 = getOWLDescription(axiom.getSuperConcept()); + Set<OWLDescription> ds = new HashSet<OWLDescription>(); + ds.add(d1); + ds.add(d2); + OWLAxiom axiomOWLAPI = factory.getOWLSubClassAxiom(d1,d2); + addAxiom(axiomOWLAPI); + } + +} Deleted: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java 2008-02-12 09:15:20 UTC (rev 544) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIConverterVisitor.java 2008-02-12 09:20:06 UTC (rev 545) @@ -1,284 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.reasoning; - -import java.net.URI; - -import org.dllearner.core.owl.ClassAssertionAxiom; -import org.dllearner.core.owl.DatatypeProperty; -import org.dllearner.core.owl.DatatypeValueRestriction; -import org.dllearner.core.owl.DoubleDatatypePropertyAssertion; -import org.dllearner.core.owl.EquivalentClassesAxiom; -import org.dllearner.core.owl.FunctionalObjectPropertyAxiom; -import org.dllearner.core.owl.Intersection; -import org.dllearner.core.owl.InverseObjectPropertyAxiom; -import org.dllearner.core.owl.KB; -import org.dllearner.core.owl.KBElementVisitor; -import org.dllearner.core.owl.Negation; -import org.dllearner.core.owl.Nothing; -import org.dllearner.core.owl.ObjectAllRestriction; -import org.dllearner.core.owl.ObjectExactCardinalityRestriction; -import org.dllearner.core.owl.ObjectMaxCardinalityRestriction; -import org.dllearner.core.owl.ObjectMinCardinalityRestriction; -import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.ObjectPropertyAssertion; -import org.dllearner.core.owl.ObjectPropertyInverse; -import org.dllearner.core.owl.ObjectSomeRestriction; -import org.dllearner.core.owl.ObjectValueRestriction; -import org.dllearner.core.owl.SubClassAxiom; -import org.dllearner.core.owl.SymmetricObjectPropertyAxiom; -import org.dllearner.core.owl.Thing; -import org.dllearner.core.owl.TransitiveObjectPropertyAxiom; -import org.dllearner.core.owl.Union; -import org.semanticweb.owl.model.AddAxiom; -import org.semanticweb.owl.model.OWLAxiom; -import org.semanticweb.owl.model.OWLDataFactory; -import org.semanticweb.owl.model.OWLIndividual; -import org.semanticweb.owl.model.OWLObjectProperty; -import org.semanticweb.owl.model.OWLOntology; -import org.semanticweb.owl.model.OWLOntologyChangeException; -import org.semanticweb.owl.model.OWLOntologyManager; - -/** - * A converter from DL-Learner format to OWL API format. - * - * @author Jens Lehmann - * - */ -public class OWLAPIConverterVisitor implements KBElementVisitor { - - OWLDataFactory factory; - private OWLOntology ontology; - private OWLOntologyManager manager; - - public OWLAPIConverterVisitor(OWLOntologyManager manager, OWLOntology ontology, KB kb) { - this.manager = manager; - this.ontology = ontology; - factory = manager.getOWLDataFactory(); - } - - private void addAxiom(OWLAxiom axiom) { - AddAxiom addAxiom = new AddAxiom(ontology, axiom); - try { - manager.applyChange(addAxiom); - } catch (OWLOntologyChangeException e) { - e.printStackTrace(); - } - } - - /* (non-Javadoc) - * @see org.dllearner.core.dl.AxiomVisitor#visit(org.dllearner.core.dl.ObjectPropertyAssertion) - */ - public void visit(ObjectPropertyAssertion axiom) { - OWLObjectProperty role = factory.getOWLObjectProperty( - URI.create(((ObjectPropertyAssertion) axiom).getRole().getName())); - OWLIndividual i1 = factory.getOWLIndividual( - URI.create(((ObjectPropertyAssertion) axiom).getIndividual1().getName())); - OWLIndividual i2 = factory.getOWLIndividual( - URI.create(((ObjectPropertyAssertion) axiom).getIndividual2().getName())); - OWLAxiom axiomOWLAPI = factory.getOWLObjectPropertyAssertionAxiom(i1, role, i2); - addAxiom(axiomOWLAPI); - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.AssertionalAxiomVisitor#visit(org.dllearner.core.owl.ClassAssertionAxiom) - */ - public void visit(ClassAssertionAxiom axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.AssertionalAxiomVisitor#visit(org.dllearner.core.owl.DoubleDatatypePropertyAssertion) - */ - public void visit(DoubleDatatypePropertyAssertion axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.FunctionalObjectPropertyAxiom) - */ - public void visit(FunctionalObjectPropertyAxiom axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.InverseObjectPropertyAxiom) - */ - public void visit(InverseObjectPropertyAxiom axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.SymmetricObjectPropertyAxiom) - */ - public void visit(SymmetricObjectPropertyAxiom axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.TransitiveObjectPropertyAxiom) - */ - public void visit(TransitiveObjectPropertyAxiom axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.TerminologicalAxiomVisitor#visit(org.dllearner.core.owl.EquivalentClassesAxiom) - */ - public void visit(EquivalentClassesAxiom axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.TerminologicalAxiomVisitor#visit(org.dllearner.core.owl.SubClassAxiom) - */ - public void visit(SubClassAxiom axiom) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Negation) - */ - public void visit(Negation description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectAllRestriction) - */ - public void visit(ObjectAllRestriction description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectSomeRestriction) - */ - public void visit(ObjectSomeRestriction description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Nothing) - */ - public void visit(Nothing description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Thing) - */ - public void visit(Thing description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Intersection) - */ - public void visit(Intersection description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Union) - */ - public void visit(Union description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectMinCardinalityRestriction) - */ - public void visit(ObjectMinCardinalityRestriction description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectExactCardinalityRestriction) - */ - public void visit(ObjectExactCardinalityRestriction description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectMaxCardinalityRestriction) - */ - public void visit(ObjectMaxCardinalityRestriction description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectValueRestriction) - */ - public void visit(ObjectValueRestriction description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.DatatypeValueRestriction) - */ - public void visit(DatatypeValueRestriction description) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.PropertyExpressionVisitor#visit(org.dllearner.core.owl.ObjectProperty) - */ - public void visit(ObjectProperty property) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.PropertyExpressionVisitor#visit(org.dllearner.core.owl.ObjectPropertyInverse) - */ - public void visit(ObjectPropertyInverse property) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.dllearner.core.owl.PropertyExpressionVisitor#visit(org.dllearner.core.owl.DatatypeProperty) - */ - public void visit(DatatypeProperty property) { - // TODO Auto-generated method stub - - } - -} Added: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIDescriptionConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIDescriptionConvertVisitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIDescriptionConvertVisitor.java 2008-02-12 09:20:06 UTC (rev 545) @@ -0,0 +1,256 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.reasoning; + +import java.net.URI; +import java.util.HashSet; +import java.util.Set; +import java.util.Stack; + +import org.dllearner.algorithms.gp.ADC; +import org.dllearner.core.owl.DatatypeExactCardinalityRestriction; +import org.dllearner.core.owl.DatatypeMaxCardinalityRestriction; +import org.dllearner.core.owl.DatatypeMinCardinalityRestriction; +import org.dllearner.core.owl.DatatypeSomeRestriction; +import org.dllearner.core.owl.DatatypeValueRestriction; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.DescriptionVisitor; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.ObjectAllRestriction; +import org.dllearner.core.owl.ObjectExactCardinalityRestriction; +import org.dllearner.core.owl.ObjectMaxCardinalityRestriction; +import org.dllearner.core.owl.ObjectMinCardinalityRestriction; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.ObjectValueRestriction; +import org.dllearner.core.owl.Thing; +import org.dllearner.core.owl.Union; +import org.dllearner.parser.KBParser; +import org.dllearner.parser.ParseException; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLObjectProperty; + +/** + * Converter from DL-Learner descriptions to OWL API descriptions based + * on the visitor pattern. + * + * @author Jens Lehmann + * + */ +public class OWLAPIDescriptionConvertVisitor implements DescriptionVisitor { + + // private OWLDescription description; + private Stack<OWLDescription> stack = new Stack<OWLDescription>(); + + private OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory(); + + public OWLDescription getOWLDescription() { + return stack.pop(); + } + + /** + * Converts a DL-Learner description into an OWL API decription. + * @param description DL-Learner description. + * @return Corresponding OWL API description. + */ + public static OWLDescription getOWLDescription(Description description) { + OWLAPIDescriptionConvertVisitor converter = new OWLAPIDescriptionConvertVisitor(); + description.accept(converter); + return converter.getOWLDescription(); + } + + /** + * Used for testing the OWL API converter. + * + * @param args + */ + public static void main(String[] args) { + try { + Description d = KBParser.parseConcept("(male AND (rich OR NOT stupid))"); + OWLDescription od = OWLAPIDescriptionConvertVisitor.getOWLDescription(d); + System.out.println(d); + System.out.println(od); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Negation) + */ + public void visit(Negation description) { + description.getChild(0).accept(this); + OWLDescription d = stack.pop(); + stack.push(factory.getOWLObjectComplementOf(d)); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectAllRestriction) + */ + public void visit(ObjectAllRestriction description) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(description.getRole().getName())); + description.getChild(0).accept(this); + OWLDescription d = stack.pop(); + stack.push(factory.getOWLObjectAllRestriction(role, d)); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectSomeRestriction) + */ + public void visit(ObjectSomeRestriction description) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(description.getRole().getName())); + description.getChild(0).accept(this); + OWLDescription d = stack.pop(); + stack.push(factory.getOWLObjectSomeRestriction(role, d)); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Nothing) + */ + public void visit(Nothing description) { + stack.push(factory.getOWLNothing()); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Thing) + */ + public void visit(Thing description) { + stack.push(factory.getOWLThing()); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Intersection) + */ + public void visit(Intersection description) { + Set<OWLDescription> descriptions = new HashSet<OWLDescription>(); + for(Description child : description.getChildren()) { + child.accept(this); + descriptions.add(stack.pop()); + } + stack.push(factory.getOWLObjectIntersectionOf(descriptions)); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.Union) + */ + public void visit(Union description) { + Set<OWLDescription> descriptions = new HashSet<OWLDescription>(); + for(Description child : description.getChildren()) { + child.accept(this); + descriptions.add(stack.pop()); + } + stack.push(factory.getOWLObjectUnionOf(descriptions)); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectMinCardinalityRestriction) + */ + public void visit(ObjectMinCardinalityRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectExactCardinalityRestriction) + */ + public void visit(ObjectExactCardinalityRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectMaxCardinalityRestriction) + */ + public void visit(ObjectMaxCardinalityRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectValueRestriction) + */ + public void visit(ObjectValueRestriction description) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.DatatypeValueRe... [truncated message content] |
From: <jen...@us...> - 2008-02-12 12:10:58
|
Revision: 547 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=547&view=rev Author: jenslehmann Date: 2008-02-12 04:10:53 -0800 (Tue, 12 Feb 2008) Log Message: ----------- - another visitor for arbitrary elements of a knowledge base - implemented export of double data type assertion using OWL API - marker interface for named elements of a knowledge base Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Axiom.java trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Individual.java trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/KB.java trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java trunk/src/dl-learner/org/dllearner/core/owl/Negation.java trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Thing.java trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Union.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/owl/NamedKBElement.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-12 12:10:53 UTC (rev 547) @@ -4,6 +4,7 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.DescriptionVisitor; +import org.dllearner.core.owl.KBElementVisitor; public class ADC extends Description { @@ -39,4 +40,8 @@ visitor.visit(this); } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/AssertionalAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -1,5 +1,5 @@ package org.dllearner.core.owl; public abstract class AssertionalAxiom extends Axiom { - + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Axiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Axiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/Axiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -7,4 +7,5 @@ return toString(null, null); } + public abstract void accept(AxiomVisitor visitor); } Modified: trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/AxiomVisitor.java 2008-02-12 12:10:53 UTC (rev 547) @@ -27,7 +27,5 @@ * */ public interface AxiomVisitor extends AssertionalAxiomVisitor, PropertyAxiomVisitor, TerminologicalAxiomVisitor { - - } Modified: trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java 2008-02-12 12:10:53 UTC (rev 547) @@ -19,10 +19,47 @@ */ package org.dllearner.core.owl; +import java.util.Map; + /** + * Allows to specify the value of a boolean datatype restriction, + * e.g. ChemicalSubstance AND EXISTS acidTest = true + * * @author Jens Lehmann * */ public class BooleanDataRange extends DataRange { + private boolean isTrue; + + public BooleanDataRange(boolean isTrue) { + this.isTrue = isTrue; + } + + /** + * @return The boolean value of this restriction. + */ + public boolean isTrue() { + return isTrue; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + // length is 1, because we have either true or false + return 1; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -53,4 +53,13 @@ public String toString(String baseURI, Map<String,String> prefixes) { return concept.toString(baseURI, prefixes) + "(" + individual + ")"; } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java 2008-02-12 12:10:53 UTC (rev 547) @@ -23,6 +23,6 @@ * @author Jens Lehmann * */ -public abstract class DataRange { +public abstract class DataRange implements KBElement { } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -52,12 +52,12 @@ return null; } - /* (non-Javadoc) - * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) - */ @Override public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -52,11 +52,12 @@ return null; } - /* (non-Javadoc) - * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) - */ @Override public void accept(DescriptionVisitor visitor) { visitor.visit(this); - } + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -59,4 +59,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-02-12 12:10:53 UTC (rev 547) @@ -27,7 +27,7 @@ * @author Jens Lehmann * */ -public class DatatypeProperty extends PropertyExpression implements Property { +public class DatatypeProperty extends PropertyExpression implements Property, NamedKBElement { protected String name; @@ -42,6 +42,10 @@ return 1; } + public String getName() { + return name; + } + /* (non-Javadoc) * @see org.dllearner.core.dl.KBElement#toString(java.lang.String, java.util.Map) */ @@ -49,4 +53,7 @@ return Helper.getAbbreviatedString(name, baseURI, prefixes); } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -66,5 +66,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } - + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -32,4 +32,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java 2008-02-12 12:10:53 UTC (rev 547) @@ -33,9 +33,7 @@ super(datatypeProperty, individual); this.value = value; } - - /* (non-Javadoc) * @see org.dllearner.core.dl.KBElement#toString(java.lang.String, java.util.Map) */ @@ -47,4 +45,12 @@ return value; } + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java 2008-02-12 12:10:53 UTC (rev 547) @@ -19,6 +19,8 @@ */ package org.dllearner.core.owl; +import java.util.Map; + /** * Double data range restricted by a maximum value, e.g. * hasAge <= 65. @@ -40,5 +42,24 @@ public double getValue() { return value; } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + return 2; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java 2008-02-12 12:10:53 UTC (rev 547) @@ -19,6 +19,8 @@ */ package org.dllearner.core.owl; +import java.util.Map; + /** * Double data range restricted by a maximum value, e.g. * hasAge >= 18. @@ -39,6 +41,24 @@ */ public double getValue() { return value; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + return 2; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -27,4 +27,13 @@ public String toString(String baseURI, Map<String,String> prefixes) { return concept1.toString(baseURI, prefixes) + " = " + concept2.toString(baseURI, prefixes); } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -21,4 +21,13 @@ public String toString(String baseURI, Map<String,String> prefixes) { return "Functional(" + role.toString(baseURI, prefixes) + ")"; } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Individual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Individual.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/Individual.java 2008-02-12 12:10:53 UTC (rev 547) @@ -29,7 +29,7 @@ * @author Jens Lehmann * */ -public class Individual implements KBElement, Comparable<Individual> { +public class Individual implements NamedKBElement, Comparable<Individual> { private String name; @@ -62,5 +62,9 @@ public String toString(String baseURI, Map<String,String> prefixes) { return Helper.getAbbreviatedString(name, baseURI, prefixes); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java 2008-02-12 12:10:53 UTC (rev 547) @@ -62,4 +62,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -27,4 +27,13 @@ public String toString(String baseURI, Map<String,String> prefixes) { return "Inverse(" + inverseRole + "," + role.toString(baseURI, prefixes) + ")"; } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-02-12 12:10:53 UTC (rev 547) @@ -223,4 +223,8 @@ return (abox.size() + tbox.size() + rbox.size()); } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java 2008-02-12 12:10:53 UTC (rev 547) @@ -13,4 +13,6 @@ public int getLength(); public String toString(String baseURI, Map<String,String> prefixes); + + public void accept(KBElementVisitor visitor); } Modified: trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java 2008-02-12 12:10:53 UTC (rev 547) @@ -27,4 +27,14 @@ */ public interface KBElementVisitor extends AxiomVisitor, DescriptionVisitor, PropertyExpressionVisitor { + void visit(BooleanDataRange booleanDataRange); + + void visit(DoubleMaxValue doubleMaxValue); + + void visit(DoubleMinValue doubleMinValue); + + void visit(Individual individual); + + void visit(KB kb); + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-02-12 12:10:53 UTC (rev 547) @@ -30,7 +30,7 @@ * @author Jens Lehmann * */ -public class NamedClass extends Description { +public class NamedClass extends Description implements NamedKBElement { String name; @@ -66,5 +66,9 @@ @Override public void accept(DescriptionVisitor visitor) { visitor.visit(this); - } + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Added: trunk/src/dl-learner/org/dllearner/core/owl/NamedKBElement.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/NamedKBElement.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/NamedKBElement.java 2008-02-12 12:10:53 UTC (rev 547) @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Marker interface for those OWL elements, which have a name, e.g. + * the name of an individual, an object property, a data type property + * or a named class. + * + * @author Jens Lehmann + * + */ +public interface NamedKBElement extends KBElement { + + public String getName(); +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/Negation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Negation.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/Negation.java 2008-02-12 12:10:53 UTC (rev 547) @@ -38,4 +38,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java 2008-02-12 12:10:53 UTC (rev 547) @@ -34,4 +34,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -102,5 +102,9 @@ @Override public void accept(DescriptionVisitor visitor) { visitor.visit(this); - } + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -47,4 +47,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -24,4 +24,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -24,4 +24,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-02-12 12:10:53 UTC (rev 547) @@ -30,7 +30,7 @@ * @author Jens Lehmann * */ -public class ObjectProperty extends ObjectPropertyExpression implements Property { +public class ObjectProperty extends ObjectPropertyExpression implements Property, NamedKBElement { public ObjectProperty(String name) { super(name); @@ -48,4 +48,8 @@ public String toString(String baseURI, Map<String,String> prefixes) { return Helper.getAbbreviatedString(name, baseURI, prefixes); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java 2008-02-12 12:10:53 UTC (rev 547) @@ -51,6 +51,11 @@ public ObjectProperty getRole() { return role; } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } public int getLength() { return 2 + role.getLength(); @@ -59,4 +64,8 @@ public String toString(String baseURI, Map<String,String> prefixes) { return role.toString(baseURI, prefixes) + "(" + individual1.toString(baseURI, prefixes) + "," + individual2.toString(baseURI, prefixes) +")"; } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java 2008-02-12 12:10:53 UTC (rev 547) @@ -49,4 +49,8 @@ public String toString(String baseURI, Map<String,String> prefixes) { return Helper.getAbbreviatedString(name, baseURI, prefixes) + "-"; } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -104,4 +104,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2008-02-12 12:10:53 UTC (rev 547) @@ -20,6 +20,9 @@ package org.dllearner.core.owl; /** + * Restricts the value of an object property to a single individual + * (corresponds to owl:hasValue). + * * @author Jens Lehmann * */ @@ -33,4 +36,7 @@ visitor.visit(this); } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -1,5 +1,5 @@ package org.dllearner.core.owl; public abstract class PropertyAxiom extends Axiom { - + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java 2008-02-12 12:10:53 UTC (rev 547) @@ -34,4 +34,6 @@ public void visit(SymmetricObjectPropertyAxiom axiom); public void visit(TransitiveObjectPropertyAxiom axiom); + + public void visit(SubObjectPropertyAxiom axiom); } Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -27,4 +27,13 @@ public String toString(String baseURI, Map<String,String> prefixes) { return subConcept.toString(baseURI, prefixes) + " SUBCONCEPTOF " + superConcept.toString(baseURI, prefixes); } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -26,5 +26,14 @@ public String toString(String baseURI, Map<String,String> prefixes) { return "Subrole(" + subRole.toString(baseURI, prefixes) + "," + role.toString(baseURI, prefixes) + ")"; - } + } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -20,5 +20,14 @@ public String toString(String baseURI, Map<String,String> prefixes) { return "Symmetric(" + role.toString(baseURI, prefixes) + ")"; + } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/TerminologicalAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -1,5 +1,5 @@ package org.dllearner.core.owl; public abstract class TerminologicalAxiom extends Axiom { - + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Thing.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Thing.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/Thing.java 2008-02-12 12:10:53 UTC (rev 547) @@ -32,4 +32,8 @@ public void accept(DescriptionVisitor visitor) { visitor.visit(this); } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java 2008-02-12 12:10:53 UTC (rev 547) @@ -21,4 +21,13 @@ public String toString(String baseURI, Map<String,String> prefixes) { return "Transitive(" + role.toString(baseURI, prefixes) + ")"; } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Union.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Union.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/core/owl/Union.java 2008-02-12 12:10:53 UTC (rev 547) @@ -65,4 +65,7 @@ visitor.visit(this); } + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-12 12:10:53 UTC (rev 547) @@ -23,6 +23,7 @@ import java.util.HashSet; import java.util.Set; +import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.AxiomVisitor; import org.dllearner.core.owl.ClassAssertionAxiom; import org.dllearner.core.owl.DoubleDatatypePropertyAssertion; @@ -32,17 +33,22 @@ import org.dllearner.core.owl.KB; import org.dllearner.core.owl.ObjectPropertyAssertion; import org.dllearner.core.owl.SubClassAxiom; +import org.dllearner.core.owl.SubObjectPropertyAxiom; import org.dllearner.core.owl.SymmetricObjectPropertyAxiom; import org.dllearner.core.owl.TransitiveObjectPropertyAxiom; import org.semanticweb.owl.model.AddAxiom; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataProperty; +import org.semanticweb.owl.model.OWLDataType; import org.semanticweb.owl.model.OWLDescription; import org.semanticweb.owl.model.OWLIndividual; import org.semanticweb.owl.model.OWLObjectProperty; import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyChangeException; import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.OWLTypedConstant; +import org.semanticweb.owl.vocab.XSDVocabulary; // static import for easy access to the description converter import static org.dllearner.reasoning.OWLAPIDescriptionConvertVisitor.getOWLDescription; @@ -71,11 +77,14 @@ } public static void fillOWLOntology(OWLOntologyManager manager, OWLOntology ontology, KB kb) { - // OWLAPIAxiomConvertVisitor converter = new OWLAPIAxiomConvertVisitor(manager, ontology, kb); - // for(Axiom axiom : kb.getTbox()) - // axiom.accept(this); - // return converter.getOWLDescription(); - } + OWLAPIAxiomConvertVisitor converter = new OWLAPIAxiomConvertVisitor(manager, ontology, kb); + for(Axiom axiom : kb.getTbox()) + axiom.accept(converter); + for(Axiom axiom : kb.getRbox()) + axiom.accept(converter); + for(Axiom axiom : kb.getAbox()) + axiom.accept(converter); + } // convencience function for adding an axiom to the ontology private void addAxiom(OWLAxiom axiom) { @@ -122,8 +131,13 @@ * @see org.dllearner.core.owl.AssertionalAxiomVisitor#visit(org.dllearner.core.owl.DoubleDatatypePropertyAssertion) */ public void visit(DoubleDatatypePropertyAssertion axiom) { - // TODO Auto-generated method stub - + OWLIndividual i = factory.getOWLIndividual(URI.create(axiom.getIndividual().getName())); + OWLDataProperty dp = factory.getOWLDataProperty(URI.create(axiom.getDatatypeProperty().getName())); + Double value = axiom.getValue(); + OWLDataType doubleType = factory.getOWLDataType(XSDVocabulary.DOUBLE.getURI()); + OWLTypedConstant valueConstant = factory.getOWLTypedConstant(value.toString(), doubleType); + OWLAxiom axiomOWLAPI = factory.getOWLDataPropertyAssertionAxiom(i, dp, valueConstant); + addAxiom(axiomOWLAPI); } /* @@ -176,6 +190,18 @@ addAxiom(axiomOWLAPI); } + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.SubObjectPropertyAxiom) + */ + public void visit(SubObjectPropertyAxiom axiom) { + OWLObjectProperty role = factory.getOWLObjectProperty( + URI.create(((SubObjectPropertyAxiom) axiom).getRole().getName())); + OWLObjectProperty subRole = factory.getOWLObjectProperty( + URI.create(((SubObjectPropertyAxiom) axiom).getSubRole().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLSubObjectPropertyAxiom(subRole, role); + addAxiom(axiomOWLAPI); + } + /* * (non-Javadoc) * @@ -206,4 +232,6 @@ addAxiom(axiomOWLAPI); } + + } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-12 11:36:32 UTC (rev 546) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-12 12:10:53 UTC (rev 547) @@ -532,7 +532,8 @@ OWLOntology ontology; try { ontology = manager.createOntology(ontologyURI); - OWLAPIReasoner.fillOWLAPIOntology(manager, ontology, kb); + // OWLAPIReasoner.fillOWLAPIOntology(manager, ontology, kb); + OWLAPIAxiomConvertVisitor.fillOWLOntology(manager, ontology, kb); manager.saveOntology(ontology); } catch (OWLOntologyCreationException e) { // TODO Auto-generated catch block This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-12 20:08:52
|
Revision: 550 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=550&view=rev Author: jenslehmann Date: 2008-02-12 12:08:48 -0800 (Tue, 12 Feb 2008) Log Message: ----------- - support for object/datatype property domains/ranges in DL-Learner OWL core - carcinogenesis mapper extended Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java trunk/src/dl-learner/org/dllearner/core/owl/Description.java trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyDomainAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyRange.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java Modified: trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java 2008-02-12 15:32:56 UTC (rev 549) +++ trunk/src/dl-learner/org/dllearner/core/owl/DataRange.java 2008-02-12 20:08:48 UTC (rev 550) @@ -23,6 +23,6 @@ * @author Jens Lehmann * */ -public abstract class DataRange implements KBElement { +public abstract class DataRange implements PropertyRange { } Added: trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,70 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * Enumeration of possible types wrapped in a class such that + * it is a valid data range. + * + * @author Jens Lehmann + * + */ +public class Datatype extends DataRange { + + public enum Type { DOUBLE, INT, BOOLEAN }; + + private Type type; + + public Datatype(Type type) { + this.type = type; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#accept(org.dllearner.core.owl.KBElementVisitor) + */ + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + return 1; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + /** + * @return the type + */ + public Type getType() { + return type; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,69 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class DatatypePropertyDomainAxiom extends PropertyDomainAxiom { + + public DatatypePropertyDomainAxiom(DatatypeProperty property, Description domain) { + super(property, domain); + } + + @Override + public DatatypeProperty getProperty() { + return (DatatypeProperty) property; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + return domain.getLength() + 2; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Axiom#accept(org.dllearner.core.owl.AxiomVisitor) + */ + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#accept(org.dllearner.core.owl.KBElementVisitor) + */ + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class DatatypePropertyRangeAxiom extends PropertyRangeAxiom { + + public DatatypePropertyRangeAxiom(DatatypeProperty property, DataRange domain) { + super(property, domain); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + return range.getLength() + 2; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Axiom#accept(org.dllearner.core.owl.AxiomVisitor) + */ + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#accept(org.dllearner.core.owl.KBElementVisitor) + */ + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/Description.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Description.java 2008-02-12 15:32:56 UTC (rev 549) +++ trunk/src/dl-learner/org/dllearner/core/owl/Description.java 2008-02-12 20:08:48 UTC (rev 550) @@ -10,7 +10,7 @@ * @author jl * */ -public abstract class Description implements Cloneable, KBElement { +public abstract class Description implements Cloneable, PropertyRange, KBElement { protected Description parent = null; protected List<Description> children = new LinkedList<Description>(); Modified: trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java 2008-02-12 15:32:56 UTC (rev 549) +++ trunk/src/dl-learner/org/dllearner/core/owl/KBElementVisitor.java 2008-02-12 20:08:48 UTC (rev 550) @@ -27,6 +27,8 @@ */ public interface KBElementVisitor extends AxiomVisitor, DescriptionVisitor, PropertyExpressionVisitor { + void visit(Datatype datatype); + void visit(BooleanDataRange booleanDataRange); void visit(DoubleMaxValue doubleMaxValue); Added: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class ObjectPropertyDomainAxiom extends PropertyDomainAxiom { + + public ObjectPropertyDomainAxiom(ObjectProperty property, Description domain) { + super(property, domain); + } + + @Override + public ObjectProperty getProperty() { + return (ObjectProperty) property; + } + + + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + return domain.getLength() + 2; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +import java.util.Map; + +/** + * @author Jens Lehmann + * + */ +public class ObjectPropertyRangeAxiom extends PropertyRangeAxiom { + + + public ObjectPropertyRangeAxiom(ObjectProperty property, Description domain) { + super(property, domain); + } + + + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#getLength() + */ + public int getLength() { + return range.getLength() + 2; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) + */ + public String toString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Axiom#accept(org.dllearner.core.owl.AxiomVisitor) + */ + @Override + public void accept(AxiomVisitor visitor) { + visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#accept(org.dllearner.core.owl.KBElementVisitor) + */ + public void accept(KBElementVisitor visitor) { + visitor.visit(this); + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java 2008-02-12 15:32:56 UTC (rev 549) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyAxiomVisitor.java 2008-02-12 20:08:48 UTC (rev 550) @@ -36,4 +36,12 @@ public void visit(TransitiveObjectPropertyAxiom axiom); public void visit(SubObjectPropertyAxiom axiom); + + void visit(DatatypePropertyDomainAxiom axiom); + + void visit(ObjectPropertyDomainAxiom axiom); + + void visit(DatatypePropertyRangeAxiom axiom); + + void visit(ObjectPropertyRangeAxiom axiom); } Added: trunk/src/dl-learner/org/dllearner/core/owl/PropertyDomainAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyDomainAxiom.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyDomainAxiom.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * Axiom to specifiy the domain of a property. + * + * @author Jens Lehmann + * + */ +public abstract class PropertyDomainAxiom extends PropertyAxiom { + + Description domain; + Property property; + + public PropertyDomainAxiom(Property property, Description domain) { + this.property = property; + this.domain = domain; + } + + public Description getDomain() { + return domain; + } + + public Property getProperty() { + return property; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/PropertyRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyRange.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyRange.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public interface PropertyRange extends KBElement { + +} Added: trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java 2008-02-12 20:08:48 UTC (rev 550) @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.owl; + +/** + * @author Jens Lehmann + * + */ +public abstract class PropertyRangeAxiom extends PropertyAxiom { + + Property property; + PropertyRange range; + + public PropertyRangeAxiom(Property property, PropertyRange range) { + this.property = property; + this.range = range; + } + + public Property getProperty() { + return property; + } + +} Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-12 15:32:56 UTC (rev 549) +++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-12 20:08:48 UTC (rev 550) @@ -28,6 +28,8 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Axiom; @@ -39,6 +41,7 @@ import org.dllearner.core.owl.KB; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectPropertyAssertion; +import org.dllearner.core.owl.SubClassAxiom; import org.dllearner.parser.ParseException; import org.dllearner.parser.PrologParser; import org.dllearner.prolog.Atom; @@ -74,6 +77,14 @@ // mapping of symbols to names of chemical elements private static Map<String,String> chemElements; + // types of atoms and bonds + private static Set<String> atomTypes = new TreeSet<String>(); + private static Set<String> bondTypes = new TreeSet<String>(); + + // we need a counter for bonds, because they are instances in OWL + // but not in Prolog + private static int bondNr = 0; + /** * @param args * No arguments supported. @@ -120,13 +131,22 @@ } // prepare mapping + KB kb = new KB(); createChemElementsMapping(); + // create subclasses of atom + NamedClass atomClass = getAtomicConcept("Atom"); + for(String element : chemElements.values()) { + NamedClass elClass = getAtomicConcept(element); + SubClassAxiom sc = new SubClassAxiom(elClass, atomClass); + kb.addAxiom(sc); + } + // define properties including domain and range + // ... TODO ... // mapping clauses to axioms System.out.print("Mapping clauses to axioms ... "); startTime = System.nanoTime(); ArrayList<Clause> clauses = program.getClauses(); - KB kb = new KB(); for (Clause clause : clauses) { List<Axiom> axioms = mapClause(clause); for (Axiom axiom : axioms) @@ -153,8 +173,7 @@ // ArrayList<Literal> literals = body.getLiterals(); // handle: atm(compound,atom,element,atomtype,charge) if (headName.equals("atm")) { - // System.out.println(clause.toPLString()); - // System.out.println(clause); + String compoundName = head.getArgument(0).toPLString(); String atomName = head.getArgument(1).toPLString(); String elementName = head.getArgument(2).toPLString(); @@ -167,11 +186,47 @@ String atomClass = getAtomClass(elementName, type); ClassAssertionAxiom ca = getConceptAssertion(atomClass,atomName); axioms.add(ca); + // write subclass axiom if doesn't exist already + if(!atomTypes.contains(atomClass)) { + NamedClass subClass = getAtomicConcept(atomClass); + NamedClass superClass = getAtomicConcept(getFullElementName(elementName)); + SubClassAxiom sc = new SubClassAxiom(subClass, superClass); + axioms.add(sc); + atomTypes.add(atomClass); + } // charge of atom DatatypePropertyAssertion dpa = getDoubleDatatypePropertyAssertion(atomName, "charge", charge); axioms.add(dpa); + } else if(headName.equals("bond")) { + String compoundName = head.getArgument(0).toPLString(); + String atom1Name = head.getArgument(1).toPLString(); + String atom2Name = head.getArgument(2).toPLString(); + String bondType = head.getArgument(3).toPLString(); + String bondClass = "Bond-" + bondType; + String bondInstance = "bond" + bondNr; + ObjectPropertyAssertion op = getRoleAssertion("hasBond", compoundName, "bond" + bondNr); + axioms.add(op); + // make Bond-X subclass of Bond if that hasn't been done already + if(!bondTypes.contains(bondClass)) { + NamedClass subClass = getAtomicConcept(bondClass); + SubClassAxiom sc = new SubClassAxiom(subClass, getAtomicConcept("Bond")); + axioms.add(sc); + bondTypes.add(bondClass); + } + // make e.g. bond382 instance of Bond-3 + ClassAssertionAxiom ca = getConceptAssertion(bondClass, bondInstance); + axioms.add(ca); + bondNr++; + // connect atoms with bond + ObjectPropertyAssertion op1 = getRoleAssertion("inBond", bondInstance, atom1Name); + ObjectPropertyAssertion op2 = getRoleAssertion("inBond", bondInstance, atom2Name); + axioms.add(op1); + axioms.add(op2); } else { // print clauses which are not supported yet + System.out.println("unsupported clause"); + System.out.println(clause.toPLString()); + System.out.println(clause); } return axioms; } @@ -193,8 +248,8 @@ return new ObjectPropertyAssertion(ar,ind1,ind2); } - private static DoubleDatatypePropertyAssertion getDoubleDatatypePropertyAssertion(String datatypeProperty, String i, double value) { - Individual ind = getIndividual(i); + private static DoubleDatatypePropertyAssertion getDoubleDatatypePropertyAssertion(String individual, String datatypeProperty, double value) { + Individual ind = getIndividual(individual); DatatypeProperty dp = getDatatypeProperty(datatypeProperty); return new DoubleDatatypePropertyAssertion(dp,ind,value); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-12 15:32:56 UTC (rev 549) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-12 20:08:48 UTC (rev 550) @@ -26,12 +26,16 @@ import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.AxiomVisitor; import org.dllearner.core.owl.ClassAssertionAxiom; +import org.dllearner.core.owl.DatatypePropertyDomainAxiom; +import org.dllearner.core.owl.DatatypePropertyRangeAxiom; import org.dllearner.core.owl.DoubleDatatypePropertyAssertion; import org.dllearner.core.owl.EquivalentClassesAxiom; import org.dllearner.core.owl.FunctionalObjectPropertyAxiom; import org.dllearner.core.owl.InverseObjectPropertyAxiom; import org.dllearner.core.owl.KB; import org.dllearner.core.owl.ObjectPropertyAssertion; +import org.dllearner.core.owl.ObjectPropertyDomainAxiom; +import org.dllearner.core.owl.ObjectPropertyRangeAxiom; import org.dllearner.core.owl.SubClassAxiom; import org.dllearner.core.owl.SubObjectPropertyAxiom; import org.dllearner.core.owl.SymmetricObjectPropertyAxiom; @@ -232,6 +236,38 @@ addAxiom(axiomOWLAPI); } + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.DatatypePropertyDomainAxiom) + */ + public void visit(DatatypePropertyDomainAxiom datatypePropertyDomainAxiom) { + // TODO Auto-generated method stub + + } + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.ObjectPropertyDomainAxiom) + */ + public void visit(ObjectPropertyDomainAxiom objectPropertyDomainAxiom) { + // TODO Auto-generated method stub + + } + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.DatatypePropertyRangeAxiom) + */ + public void visit(DatatypePropertyRangeAxiom axiom) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.ObjectPropertyRangeAxiom) + */ + public void visit(ObjectPropertyRangeAxiom axiom) { + // TODO Auto-generated method stub + + } + + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-17 09:37:49
|
Revision: 584 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=584&view=rev Author: jenslehmann Date: 2008-02-17 01:37:42 -0800 (Sun, 17 Feb 2008) Log Message: ----------- - switched off extensive Pellet logging output when reasoning over OWL API - test results: using Pellet 1.5.1 via OWP API is now significantly faster compared to using Pellet 1.1 via DIG - DL-Learner with OWP API reasoning could be used as a Java Webstart application Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/utilities/Logging.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-16 14:10:01 UTC (rev 583) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-17 09:37:42 UTC (rev 584) @@ -25,13 +25,20 @@ import java.net.URL; import java.util.Collection; import java.util.Comparator; +import java.util.Enumeration; import java.util.HashSet; import java.util.LinkedList; import java.util.Set; import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; +import java.util.Vector; +import org.apache.commons.logging.impl.Log4JLogger; +import org.apache.log4j.Level; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.apache.log4j.spi.LoggerRepository; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.config.ConfigEntry; @@ -66,6 +73,7 @@ import org.dllearner.core.owl.TransitiveObjectPropertyAxiom; import org.dllearner.kb.OWLFile; import org.dllearner.utilities.ConceptComparator; +import org.dllearner.utilities.Logging; import org.dllearner.utilities.RoleComparator; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.inference.OWLReasoner; @@ -97,7 +105,7 @@ */ public class OWLAPIReasoner extends ReasonerComponent { - private String reasonerType = "fact"; + private String reasonerType = "pellet"; private Set<KnowledgeSource> sources; private OWLReasoner reasoner; @@ -127,9 +135,9 @@ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet", "FaCT++"); + StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet", "pellet"); type.setAllowedValues(new String[] {"fact", "pellet"}); - // closure-Option? siehe: + // closure option? see: // http://owlapi.svn.sourceforge.net/viewvc/owlapi/owl1_1/trunk/tutorial/src/main/java/uk/ac/manchester/owl/tutorial/examples/ClosureAxiomsExample.java?view=markup options.add(type); return options; @@ -204,6 +212,9 @@ } else { // instantiate Pellet reasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); + + Logger pelletLogger = Logger.getLogger("org.mindswap.pellet"); + pelletLogger.setLevel(Level.WARN); } /* Added: trunk/src/dl-learner/org/dllearner/utilities/Logging.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Logging.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/Logging.java 2008-02-17 09:37:42 UTC (rev 584) @@ -0,0 +1,61 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.utilities; + +import java.util.Enumeration; + +import org.apache.log4j.Appender; +import org.apache.log4j.Level; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.apache.log4j.spi.LoggerRepository; + +/** + * Logging centered utility class. + * + * @author Jens Lehmann + * + */ +public class Logging { + + /** + * Prints the currently available log4j loggers to system out. + */ + @SuppressWarnings({"unchecked"}) + public static void printCurrentLoggers() { + LoggerRepository rep = LogManager.getLoggerRepository(); + Enumeration<Logger> e = rep.getCurrentLoggers(); + while(e.hasMoreElements()) { + Logger l = e.nextElement(); + String name = l.getName(); + Level level = l.getLevel(); + Enumeration<Appender> appenders = l.getAllAppenders(); + + if(appenders.hasMoreElements()) + System.out.println("APPENDER: " + appenders.nextElement()); + + System.out.println("name : " + name); + System.out.println("level: " + level); + System.out.println("appenders: " + appenders); + System.out.println(); + } + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-17 09:48:37
|
Revision: 585 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=585&view=rev Author: jenslehmann Date: 2008-02-17 01:48:24 -0800 (Sun, 17 Feb 2008) Log Message: ----------- maybe fix of #1888650 Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-17 09:37:42 UTC (rev 584) +++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-02-17 09:48:24 UTC (rev 585) @@ -65,6 +65,8 @@ private Integer maxLength = 7; private String returnType; + private boolean stop = false; + // list of all generated concepts sorted by length private Map<Integer,List<Description>> generatedDefinitions = new HashMap<Integer,List<Description>>(); @@ -126,6 +128,9 @@ for(int i=1; i<=maxLength; i++) generatePrograms(i); + if(stop) + return; + long generationTime = System.currentTimeMillis() - generationStartTime; System.out.println("OK (" + generationTime + " ms)"); @@ -155,11 +160,15 @@ Score tmp; double score; - for(int i=1; i<=maxLength; i++) { + for(int i=1; i<=maxLength && !stop; i++) { long startTime = System.currentTimeMillis(); System.out.print("Testing definitions of length " + i + " ... "); count = 0; for(Description program : generatedDefinitions.get(i)) { + // stop testing further when algorithm is stopped + if(stop) + break; + // if a return type is already given an appropriate tree is // generated here Description newRoot; @@ -274,6 +283,7 @@ @Override public void stop() { + stop = true; } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-17 09:37:42 UTC (rev 584) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-17 09:48:24 UTC (rev 585) @@ -25,55 +25,49 @@ import java.net.URL; import java.util.Collection; import java.util.Comparator; -import java.util.Enumeration; import java.util.HashSet; import java.util.LinkedList; import java.util.Set; import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; -import java.util.Vector; -import org.apache.commons.logging.impl.Log4JLogger; import org.apache.log4j.Level; -import org.apache.log4j.LogManager; import org.apache.log4j.Logger; -import org.apache.log4j.spi.LoggerRepository; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.owl.ObjectAllRestriction; import org.dllearner.core.owl.AssertionalAxiom; -import org.dllearner.core.owl.NamedClass; -import org.dllearner.core.owl.Nothing; -import org.dllearner.core.owl.Description; import org.dllearner.core.owl.ClassAssertionAxiom; +import org.dllearner.core.owl.Description; import org.dllearner.core.owl.EquivalentClassesAxiom; -import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.FunctionalObjectPropertyAxiom; -import org.dllearner.core.owl.SubClassAxiom; import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.InverseObjectPropertyAxiom; import org.dllearner.core.owl.KB; -import org.dllearner.core.owl.Intersection; -import org.dllearner.core.owl.Union; +import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.ObjectAllRestriction; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectPropertyAssertion; -import org.dllearner.core.owl.PropertyAxiom; import org.dllearner.core.owl.ObjectPropertyHierarchy; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.PropertyAxiom; +import org.dllearner.core.owl.SubClassAxiom; import org.dllearner.core.owl.SubObjectPropertyAxiom; import org.dllearner.core.owl.SubsumptionHierarchy; import org.dllearner.core.owl.SymmetricObjectPropertyAxiom; import org.dllearner.core.owl.TerminologicalAxiom; import org.dllearner.core.owl.Thing; import org.dllearner.core.owl.TransitiveObjectPropertyAxiom; +import org.dllearner.core.owl.Union; import org.dllearner.kb.OWLFile; import org.dllearner.utilities.ConceptComparator; -import org.dllearner.utilities.Logging; import org.dllearner.utilities.RoleComparator; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.inference.OWLReasoner; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-17 10:08:17
|
Revision: 586 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=586&view=rev Author: jenslehmann Date: 2008-02-17 02:08:08 -0800 (Sun, 17 Feb 2008) Log Message: ----------- partial fix for #1880138 Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/ComponentManager.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/test/ComponentTest.java trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/LearningProblemUnsupportedException.java Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 09:48:24 UTC (rev 585) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 10:08:08 UTC (rev 586) @@ -48,6 +48,7 @@ import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.OntologyFormat; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; @@ -215,7 +216,12 @@ else handleError("Unknown value in " + algorithmOption); - la = cm.learningAlgorithm(laClass, lp, rs); + try { + la = cm.learningAlgorithm(laClass, lp, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } configureComponent(cm, la, componentPrefixMapping, parser); initComponent(cm, la); Modified: trunk/src/dl-learner/org/dllearner/core/ComponentManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-02-17 09:48:24 UTC (rev 585) +++ trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-02-17 10:08:08 UTC (rev 586) @@ -316,7 +316,7 @@ } // automagically calls the right constructor for the given learning problem - public <T extends LearningAlgorithm> T learningAlgorithm(Class<T> laClass, LearningProblem lp, ReasoningService rs) { + public <T extends LearningAlgorithm> T learningAlgorithm(Class<T> laClass, LearningProblem lp, ReasoningService rs) throws LearningProblemUnsupportedException { if (!learningAlgorithms.contains(laClass)) System.err.println("Warning: learning algorithm " + laClass + " is not a registered learning algorithm component."); @@ -330,11 +330,12 @@ } if (constructorArgument == null) { - System.err.println("Warning: No suitable constructor registered for algorithm " - + laClass.getName() + " and problem " + lp.getClass().getName() - + ". Registered constructors for " + laClass.getName() + ": " - + algorithmProblemsMapping.get(laClass) + "."); - return null; + throw new LearningProblemUnsupportedException(lp.getClass(), laClass, algorithmProblemsMapping.get(laClass)); +// System.err.println("Warning: No suitable constructor registered for algorithm " +// + laClass.getName() + " and problem " + lp.getClass().getName() +// + ". Registered constructors for " + laClass.getName() + ": " +// + algorithmProblemsMapping.get(laClass) + "."); +// return null; } T la = invokeConstructor(laClass, new Class[] { constructorArgument, ReasoningService.class }, new Object[] { lp, rs }); Added: trunk/src/dl-learner/org/dllearner/core/LearningProblemUnsupportedException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningProblemUnsupportedException.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/LearningProblemUnsupportedException.java 2008-02-17 10:08:08 UTC (rev 586) @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core; + +import java.util.Collection; + +/** + * Exception, which is thrown when an application tries to run + * a learning algorithm with a learning problem it does not + * support. + * + * @author Jens Lehmann + * + */ +public class LearningProblemUnsupportedException extends Exception { + + private static final long serialVersionUID = 177919265073997460L; + + public LearningProblemUnsupportedException(Class<? extends LearningProblem> problemClass, Class<? extends LearningAlgorithm> algorithmClass) { + super("Warning: No suitable constructor registered for algorithm " + + algorithmClass.getName() + " and problem " + problemClass.getClass().getName() + "."); + } + + public LearningProblemUnsupportedException(Class<? extends LearningProblem> problemClass, Class<? extends LearningAlgorithm> algorithmClass, Collection<Class<? extends LearningProblem>> supportedProblems) { + super("Warning: No suitable constructor registered for algorithm " + + algorithmClass.getName() + " and problem " + problemClass.getClass().getName() + + ". Registered constructors for " + algorithmClass.getName() + ": " + + supportedProblems + "."); + } + +} Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-02-17 09:48:24 UTC (rev 585) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-02-17 10:08:08 UTC (rev 586) @@ -28,6 +28,7 @@ import java.util.List; import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.LearningProblemUnsupportedException; /** * LearningAlgorithmPanel, tab 4. Choose LearningAlgorithm, change Options and @@ -107,10 +108,15 @@ public void setLearningAlgorithm() { if (config.getLearningProblem() != null && config.getReasoningService() != null) { - config.setLearningAlgorithm(config.getComponentManager() - .learningAlgorithm(learners.get(choosenClassIndex), - config.getLearningProblem(), - config.getReasoningService())); + try { + config.setLearningAlgorithm(config.getComponentManager() + .learningAlgorithm(learners.get(choosenClassIndex), + config.getLearningProblem(), + config.getReasoningService())); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } updateOptionPanel(); } } Modified: trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java 2008-02-17 09:48:24 UTC (rev 585) +++ trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java 2008-02-17 10:08:08 UTC (rev 586) @@ -43,6 +43,7 @@ import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.Description; @@ -163,7 +164,13 @@ // try the refinement operator based learning algorithm to solve // the problem - LearningAlgorithm la = cm.learningAlgorithm(ROLearner.class, lp, rs); + LearningAlgorithm la = null; + try { + la = cm.learningAlgorithm(ROLearner.class, lp, rs); + } catch (LearningProblemUnsupportedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } la.init(); la.start(); Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-17 09:48:24 UTC (rev 585) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-17 10:08:08 UTC (rev 586) @@ -45,6 +45,7 @@ import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.config.ConfigOption; import org.dllearner.core.owl.NamedClass; @@ -248,7 +249,7 @@ } @WebMethod - public int setLearningAlgorithm(int id, String component) throws ClientNotKnownException, UnknownComponentException { + public int setLearningAlgorithm(int id, String component) throws ClientNotKnownException, UnknownComponentException, LearningProblemUnsupportedException { ClientState state = getState(id); Class<? extends LearningAlgorithm> laClass = learningAlgorithmMapping.get(component); if(laClass == null) Modified: trunk/src/dl-learner/org/dllearner/test/ComponentTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-02-17 09:48:24 UTC (rev 585) +++ trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-02-17 10:08:08 UTC (rev 586) @@ -28,6 +28,7 @@ import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; import org.dllearner.kb.OWLFile; @@ -77,7 +78,13 @@ lp.init(); // create the learning algorithm - LearningAlgorithm la = cm.learningAlgorithm(RandomGuesser.class, lp, rs); + LearningAlgorithm la = null; + try { + la = cm.learningAlgorithm(RandomGuesser.class, lp, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } cm.applyConfigEntry(la, "numberOfTrees", 100); cm.applyConfigEntry(la, "maxDepth", 5); la.init(); Modified: trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2008-02-17 09:48:24 UTC (rev 585) +++ trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2008-02-17 10:08:08 UTC (rev 586) @@ -32,6 +32,7 @@ import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.OntologyFormat; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; @@ -237,7 +238,12 @@ // if(exampleNr==3 || exampleNr==5 || exampleNr == 6) // Config.percentPerLengthUnit = 0.002; // learningAlgorithm = new GP(learningProblem); - learningAlgorithm = cm.learningAlgorithm(GP.class, learningProblem, rs); + try { + learningAlgorithm = cm.learningAlgorithm(GP.class, learningProblem, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } else if(algorithmNr==2) { // Config.algorithm = Algorithm.HYBRID_GP; // Config.GP.algorithmType = GP.AlgorithmType.GENERATIONAL; @@ -255,7 +261,12 @@ // if(exampleNr == 3 || exampleNr==5 || exampleNr==6) // Config.percentPerLengthUnit = 0.002; // learningAlgorithm = new GP(learningProblem); - learningAlgorithm = cm.learningAlgorithm(GP.class, learningProblem, rs); + try { + learningAlgorithm = cm.learningAlgorithm(GP.class, learningProblem, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } // rs.resetStatistics(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-17 10:50:18
|
Revision: 588 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=588&view=rev Author: jenslehmann Date: 2008-02-17 02:50:06 -0800 (Sun, 17 Feb 2008) Log Message: ----------- - created ComponentInitException (thrown when exceptions occur during component initialisation) - abstract init method in Component now throws ComponentInitException - @developers: please update your code accordingingly (currently I only added default try-catch-blocks) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/Component.java trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/reasoning/DIGHTTPConnector.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/test/ComponentTest.java trunk/src/dl-learner/org/dllearner/utilities/CrossValidation.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/ComponentInitException.java Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 10:50:06 UTC (rev 588) @@ -44,6 +44,7 @@ import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.algorithms.refinement.ROLearner; import org.dllearner.core.Component; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; @@ -119,15 +120,22 @@ logger.addAppender(consoleAppender); logger.setLevel(Level.INFO); - Start start = new Start(file); + Start start = null; + try { + start = new Start(file); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } start.start(inQueryMode); } /** * Initialise all components based on conf file. * @param file Conf file to read. + * @throws ComponentInitException */ - public Start(File file) { + public Start(File file) throws ComponentInitException { String baseDir = file.getParentFile().getPath(); // create component manager instance @@ -542,7 +550,7 @@ } } - private static void initComponent(ComponentManager cm, Component component) { + private static void initComponent(ComponentManager cm, Component component) throws ComponentInitException { String startMessage = "initialising component \"" + cm.getComponentName(component.getClass()) + "\" ... "; long initStartTime = System.nanoTime(); Modified: trunk/src/dl-learner/org/dllearner/core/Component.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Component.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/core/Component.java 2008-02-17 10:50:06 UTC (rev 588) @@ -52,7 +52,7 @@ /** * Method to be called after the component has been configured. */ - public abstract void init(); + public abstract void init() throws ComponentInitException; /** * Applies a configuration option to this component. Added: trunk/src/dl-learner/org/dllearner/core/ComponentInitException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentInitException.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/ComponentInitException.java 2008-02-17 10:50:06 UTC (rev 588) @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core; + +/** + * Exception which is thrown when a component cannot be intialised, + * e.g. due to bad configuration parameteres or unforeseen + * circumstances unreachable web files. It can encapsulate arbitrary + * exceptions occuring during initialisation. + * + * @author Jens Lehmann + * + */ +public class ComponentInitException extends Exception { + + private static final long serialVersionUID = -3550079897929658317L; + + public ComponentInitException(String message) { + super(message); + } + + public ComponentInitException(Exception exception) { + super(exception); + } + + public ComponentInitException(String message, Exception exception) { + super(message, exception); + } +} Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-02-17 10:50:06 UTC (rev 588) @@ -26,6 +26,8 @@ import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + +import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; /** @@ -116,7 +118,12 @@ */ public void init() { if (config.getKnowledgeSource() != null && config.getURI() != null) { - config.getKnowledgeSource().init(); + try { + config.getKnowledgeSource().init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } config.setInitKnowledgeSource(true); System.out.println("init KnowledgeSource"); startGUI.updateTabColors(); Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-02-17 10:50:06 UTC (rev 588) @@ -27,6 +27,7 @@ import java.awt.event.ActionListener; import java.util.List; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblemUnsupportedException; @@ -127,7 +128,12 @@ public void init() { setLearningAlgorithm(); if (config.getLearningProblem() != null) { - config.getLearningAlgorithm().init(); + try { + config.getLearningAlgorithm().init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } config.setInitLearningAlgorithm(true); System.out.println("init LearningAlgorithm"); startGUI.updateTabColors(); Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-02-17 10:50:06 UTC (rev 588) @@ -26,6 +26,8 @@ import java.awt.event.ActionListener; import java.util.List; import javax.swing.*; + +import org.dllearner.core.ComponentInitException; import org.dllearner.core.LearningProblem; /** @@ -121,7 +123,12 @@ private void init() { setLearningProblem(); if (config.getReasoner() != null && config.getLearningProblem() != null) { - config.getLearningProblem().init(); + try { + config.getLearningProblem().init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } config.setInitLearningProblem(true); System.out.println("init LearningProblem"); startGUI.updateTabColors(); Modified: trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/gui/MiniGUI.java 2008-02-17 10:50:06 UTC (rev 588) @@ -39,6 +39,7 @@ import javax.swing.JTextField; import org.dllearner.algorithms.refinement.ROLearner; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; @@ -134,12 +135,22 @@ // (everything else will cause an exception) KnowledgeSource source = cm.knowledgeSource(OWLFile.class); cm.applyConfigEntry(source, "url", selectedFile.toURI().toString()); - source.init(); + try { + source.init(); + } catch (ComponentInitException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } // use a reasoner to find out which instances exist // in the background knowledge ReasonerComponent reasoner = cm.reasoner(DIGReasoner.class, source); - reasoner.init(); + try { + reasoner.init(); + } catch (ComponentInitException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } rs = cm.reasoningService(reasoner); Set<Individual> individualsSet = rs.getIndividuals(); individuals = new LinkedList<Individual>(individualsSet); @@ -160,7 +171,12 @@ // create a positive only learning problem LearningProblem lp = cm.learningProblem(PosOnlyDefinitionLP.class, rs); cm.applyConfigEntry(lp, "positiveExamples", exampleSet); - lp.init(); + try { + lp.init(); + } catch (ComponentInitException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } // try the refinement operator based learning algorithm to solve // the problem @@ -171,7 +187,12 @@ // TODO Auto-generated catch block e1.printStackTrace(); } - la.init(); + try { + la.init(); + } catch (ComponentInitException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } la.start(); // wait for a solution (note that not all learning problems have a Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-02-17 10:50:06 UTC (rev 588) @@ -28,6 +28,7 @@ import javax.swing.*; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ReasonerComponent; /** @@ -127,7 +128,12 @@ public void init() { setReasoner(); if (config.getKnowledgeSource() != null && config.getReasoner() != null) { - config.getReasoner().init(); + try { + config.getReasoner().init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } System.out.println("init Reasoner"); // set ReasoningService config.setReasoningService(config.getComponentManager() Modified: trunk/src/dl-learner/org/dllearner/reasoning/DIGHTTPConnector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/DIGHTTPConnector.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/reasoning/DIGHTTPConnector.java 2008-02-17 10:50:06 UTC (rev 588) @@ -67,7 +67,13 @@ public URI newKB() { NewKBDocument newKB = NewKBDocument.Factory.newInstance(); newKB.addNewNewKB(); - String answer = sendAndReceive(newKB.toString()); + String answer = ""; + try { + answer = sendAndReceive(newKB.toString()); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } ResponseDocument rd = parse(answer); IdRespType rt = rd.getResponse(); @@ -89,15 +95,22 @@ public boolean releaseKB(URI kbURI) { ReleaseKBDocument releaseKB = ReleaseKBDocument.Factory.newInstance(); releaseKB.addNewReleaseKB().setUri(kbURI.toString()); - String answer = sendAndReceive(releaseKB.toString()); + String answer = ""; + try { + answer = sendAndReceive(releaseKB.toString()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } ResponseDocument rd = parse(answer); return rd.getResponse().isSetOk(); } - public String getIdentifier() { + public String getIdentifier() throws IOException { GetIdentifierDocument gid = GetIdentifierDocument.Factory.newInstance(); gid.addNewGetIdentifier(); - String answer = sendAndReceive(gid.toString()); + String answer = ""; + answer = sendAndReceive(gid.toString()); IdentifierDocument id = null; try { id = IdentifierDocument.Factory.parse(answer); @@ -111,7 +124,7 @@ } // tell-Anfrage als XML-String schicken - public ResponseDocument tells(String tells) { + public ResponseDocument tells(String tells) throws IOException { return parse(sendAndReceive(tells)); } @@ -121,7 +134,13 @@ public ResponsesDocument asks(String asks) { askCounter++; - String answer = sendAndReceive(asks); + String answer = ""; + try { + answer = sendAndReceive(asks); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } ResponsesDocument rd = null; try { rd = ResponsesDocument.Factory.parse(answer); @@ -142,13 +161,13 @@ return rd; } - private String sendAndReceive(String send) { + private String sendAndReceive(String send) throws IOException { StringBuilder answer = new StringBuilder(); // String an DIG-Reasoner schicken HttpURLConnection connection; - try { +// try { connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); @@ -174,10 +193,10 @@ br.close(); - } catch (IOException e) { - System.out.println("Communication problem with DIG Reasoner. Please make sure there is a DIG reasoner running at " + url + " and try again."); - System.exit(0); - } +// } catch (IOException e) { +// System.out.println("Communication problem with DIG Reasoner. Please make sure there is a DIG reasoner running at " + url + " and try again."); +// System.exit(0); +// } if(protocolFile != null) Files.appendFile(protocolFile, "DIG code received from reasoner:\n\n"+answer+"\n\n"); Modified: trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-02-17 10:50:06 UTC (rev 588) @@ -20,6 +20,7 @@ package org.dllearner.reasoning; import java.io.File; +import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; @@ -36,6 +37,7 @@ import javax.xml.namespace.QName; import org.apache.xmlbeans.XmlCursor; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.OntologyFormat; import org.dllearner.core.ReasonerComponent; @@ -112,7 +114,7 @@ } @Override - public void init() { + public void init() throws ComponentInitException { // if a DIG protocol is written clear the file first if(writeDIGProtocol) { if(digProtocolFile == null) @@ -123,7 +125,11 @@ connector = new DIGHTTPConnector(reasonerURL); } - identifier = connector.getIdentifier(); + try { + identifier = connector.getIdentifier(); + } catch (IOException e1) { + throw new ComponentInitException("Communication problem with DIG Reasoner. Please make sure there is a DIG reasoner running at " + reasonerURL + " and try again.", e1); + } kbURI = connector.newKB(); // asks-Prefix entsprechend der KB-URI initialisieren @@ -144,7 +150,13 @@ for (KnowledgeSource source : sources) { sb.append(source.toDIG(kbURI)); - ResponseDocument rd = connector.tells(sb.toString()); + ResponseDocument rd = null; + try { + rd = connector.tells(sb.toString()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } if (!rd.getResponse().isSetOk()) { System.err.println("DIG-Reasoner cannot read knowledgebase."); System.exit(0); Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-02-17 10:50:06 UTC (rev 588) @@ -5,6 +5,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningMethodUnsupportedException; @@ -36,7 +37,12 @@ public FastRetrievalReasoner(Set<KnowledgeSource> sources) { rc = new DIGReasoner(sources); - rc.init(); + try { + rc.init(); + } catch (ComponentInitException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } atomicConcepts = rc.getAtomicConcepts(); atomicRoles = rc.getAtomicRoles(); individuals = rc.getIndividuals(); Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-17 10:50:06 UTC (rev 588) @@ -41,6 +41,7 @@ import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.algorithms.refinement.ROLearner; import org.dllearner.core.Component; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; @@ -262,9 +263,10 @@ /** * Initialise all components. * @param id Session ID. + * @throws ComponentInitException */ @WebMethod - public void initAll(int id) throws ClientNotKnownException { + public void initAll(int id) throws ClientNotKnownException, ComponentInitException { ClientState state = getState(id); for(KnowledgeSource ks : state.getKnowledgeSources()) ks.init(); @@ -279,9 +281,10 @@ * @param componentID Component-ID. * @throws ClientNotKnownException Thrown if the client ID is nor registered. * @throws UnknownComponentException Thrown if the component is unknown. + * @throws ComponentInitException */ @WebMethod - public void init(int id, int componentID) throws ClientNotKnownException, UnknownComponentException { + public void init(int id, int componentID) throws ClientNotKnownException, UnknownComponentException, ComponentInitException { ClientState state = getState(id); Component component = state.getComponent(componentID); component.init(); Modified: trunk/src/dl-learner/org/dllearner/test/ComponentTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-02-17 10:50:06 UTC (rev 588) @@ -24,6 +24,7 @@ import java.util.TreeSet; import org.dllearner.algorithms.RandomGuesser; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; @@ -45,8 +46,9 @@ /** * @param args + * @throws ComponentInitException */ - public static void main(String[] args) { + public static void main(String[] args) throws ComponentInitException { // get singleton instance of component manager ComponentManager cm = ComponentManager.getInstance(); Modified: trunk/src/dl-learner/org/dllearner/utilities/CrossValidation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/CrossValidation.java 2008-02-17 10:11:48 UTC (rev 587) +++ trunk/src/dl-learner/org/dllearner/utilities/CrossValidation.java 2008-02-17 10:50:06 UTC (rev 588) @@ -31,6 +31,7 @@ import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; import org.dllearner.cli.Start; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; @@ -84,7 +85,13 @@ // the first read of the file is used to detect the examples // and set up the splits correctly according to our validation // method - Start start = new Start(file); + Start start = null; + try { + start = new Start(file); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } LearningProblem lp = start.getLearningProblem(); ReasoningService rs = start.getReasoningService(); @@ -162,7 +169,12 @@ for(int currFold=0; currFold<folds; currFold++) { // we always perform a full initialisation to make sure that // no objects are reused - start = new Start(file); + try { + start = new Start(file); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } lp = start.getLearningProblem(); Set<String> pos = Datastructures.individualSetToStringSet(trainingSetsPos.get(currFold)); Set<String> neg = Datastructures.individualSetToStringSet(trainingSetsNeg.get(currFold)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-17 11:18:47
|
Revision: 589 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=589&view=rev Author: jenslehmann Date: 2008-02-17 03:18:26 -0800 (Sun, 17 Feb 2008) Log Message: ----------- - component init exceptions are now thrown when KB or OWL ontologies cannot be read Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 10:50:06 UTC (rev 588) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 11:18:26 UTC (rev 589) @@ -105,7 +105,7 @@ * * @param args */ - public static void main(String[] args) { + public static void main(String[] args) throws ComponentInitException { File file = new File(args[args.length - 1]); boolean inQueryMode = false; @@ -121,12 +121,7 @@ logger.setLevel(Level.INFO); Start start = null; - try { - start = new Start(file); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + start = new Start(file); start.start(inQueryMode); } Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-17 10:50:06 UTC (rev 588) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-17 11:18:26 UTC (rev 589) @@ -27,6 +27,7 @@ import java.util.Collection; import java.util.LinkedList; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; @@ -96,13 +97,13 @@ * @see org.dllearner.core.Component#init() */ @Override - public void init() { + public void init() throws ComponentInitException { try { kb = KBParser.parseKBFile(url); } catch (IOException e) { - e.printStackTrace(); + throw new ComponentInitException("KB file " + url + " could not be read.", e); } catch (ParseException e) { - e.printStackTrace(); + throw new ComponentInitException("KB file " + url + " could not be parsed correctly.", e); } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-02-17 10:50:06 UTC (rev 588) +++ trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-02-17 11:18:26 UTC (rev 589) @@ -154,8 +154,7 @@ try { rd = connector.tells(sb.toString()); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + throw new ComponentInitException("Could not read knowledge source " + source + ".", e); } if (!rd.getResponse().isSetOk()) { System.err.println("DIG-Reasoner cannot read knowledgebase."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-17 13:09:05
|
Revision: 590 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=590&view=rev Author: jenslehmann Date: 2008-02-17 05:08:46 -0800 (Sun, 17 Feb 2008) Log Message: ----------- - added toManchester string for all descriptions - fixed toString method for named elements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/Description.java trunk/src/dl-learner/org/dllearner/core/owl/Individual.java trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java trunk/src/dl-learner/org/dllearner/core/owl/Negation.java trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/Thing.java trunk/src/dl-learner/org/dllearner/core/owl/Union.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/ADC.java 2008-02-17 13:08:46 UTC (rev 590) @@ -27,7 +27,16 @@ return "ADC"; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString() + */ @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + @Override public int getArity() { return 0; } @@ -44,4 +53,6 @@ visitor.visit(this); } + + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeExactCardinalityRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -52,12 +52,23 @@ return null; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString() + */ @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + // TODO Auto-generated method stub + return null; + } + + @Override public void accept(DescriptionVisitor visitor) { visitor.visit(this); } public void accept(KBElementVisitor visitor) { visitor.visit(this); - } + } + + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMaxCardinalityRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -60,4 +60,13 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString() + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + // TODO Auto-generated method stub + return null; + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeMinCardinalityRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -62,5 +62,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString() + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-02-17 13:08:46 UTC (rev 590) @@ -50,7 +50,7 @@ * @see org.dllearner.core.dl.KBElement#toString(java.lang.String, java.util.Map) */ public String toString(String baseURI, Map<String, String> prefixes) { - return Helper.getAbbreviatedString(name, baseURI, prefixes); + return "\"" + Helper.getAbbreviatedString(name, baseURI, prefixes) + "\""; } public void accept(KBElementVisitor visitor) { Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeSomeRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -69,5 +69,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString() + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -19,6 +19,8 @@ */ package org.dllearner.core.owl; +import java.util.Map; + /** * @author Jens Lehmann * @@ -35,5 +37,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString() + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Description.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Description.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/Description.java 2008-02-17 13:08:46 UTC (rev 590) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.owl; import java.util.LinkedList; @@ -2,8 +21,8 @@ import java.util.List; +import java.util.Map; /** - * TODO: alless was fast retrieval algorithm angeht, sollte - * ausgegliedert werden! + * A class description is sometimes also called "complex class" or "concept". * - * @author jl + * @author Jens Lehmann * @@ -14,74 +33,13 @@ protected Description parent = null; protected List<Description> children = new LinkedList<Description>(); - //protected SortedSet<String> posSet = new TreeSet<String>(); - //protected SortedSet<String> negSet = new TreeSet<String>(); - - /* - public Node(List<Node> children) { - this.children = children; - for(Node n : children) - n.setParent(this); - } - */ - - // TODO: die Methode noch hinzuf�gen + public abstract int getArity(); /** - * Berechnet die + und - Menge. Wenn die Mengen berechnet sind, dann können - * sie über die get-Methoden abgefragt werden. Der Algorithmus ist relativ - * einfach zu implementieren, aber ein großer Teil des Codes wird zum - * vermeiden von Nullpointern (bei unvollständigen Daten) eingesetzt. + * Calculate the number of nodes for this description tree (each + * description can be seen as a tree). * - * Die �bergebenen Mengen - */ - // protected abstract void calculatePosSet(FlatABox abox); - // protected abstract void calculateSets(FlatABox abox, SortedSet<String> adcPosSet, SortedSet<String> adcNegSet); - /* - // Score ohne ADF berechnen - public Score computeScore() { - return computeScore(null,null); - } - */ - - // Score mit ADF berechnen - - //public Score computeScore(SortedSet<String> adcPosSet, SortedSet<String> adcNegSet) { - /* - Set<String> posExamples = null; - Set<String> negExamples = null; - - FlatABox abox = FlatABox.getInstance(); - - // es wird angenommen, dass nur ein Konzept gelernt wird - for(String s : abox.exampleConceptsPos.keySet()) { - posExamples = abox.exampleConceptsPos.get(s); - } - for(String s : abox.exampleConceptsNeg.keySet()) { - negExamples = abox.exampleConceptsNeg.get(s); - } - - // Algorithmus anwenden - calculateSets(abox); - //Set<String> posSet = program.getPosSet(); - //Set<String> negSet = program.getNegSet(); - - // Punktzahl sind die abgedeckten positiven Beispiele + - // die nicht abgedeckten negativen Beispiele - int points = Helper.intersection(posSet,posExamples).size() - + Helper.intersection(negSet,negExamples).size(); - - // besser: Abzüge wenn pos. Beispiel negativ wird bzw. umgekehrt - - return points; - */ - // calculateSets(FlatABox.getInstance(),posSet,negSet); - // return new Score(posSet,negSet); - //} - - /** - * Calculate the number of nodes for this tree. * @return The number of nodes. */ public int getNumberOfNodes() { @@ -90,26 +48,13 @@ sum += child.getNumberOfNodes(); return sum; } - - // protected abstract int getLength(); /** - * Calculate the number of nodes for this tree. - * @return The number of nodes. - */ - /* - public int getConceptLength() { - int length = getLength(); - for (Concept child : children) - length += child.getConceptLength(); - return length; - }*/ - - /** * Selects a sub tree. * @param i A position in the tree. Positions are iteratively given to nodes * by leftmost depth-first search. This allows efficient selection of subtrees. - * (Implementation does not work if any node has more than two children.) + * (TODO: Implementation does not work if any node has more than two children + * like conjunction and disjunction.) * @return The selected subtree. */ public Description getSubtree(int i) { @@ -137,8 +82,8 @@ } /** - * Calculates the tree depth. - * @return The depth of this tree. + * Calculates the description tree depth. + * @return The depth of this description. */ public int getDepth() { // compute the max over all children @@ -154,8 +99,7 @@ } /** - * Returns a clone of this programm tree. Die positiven und negativen Sets - * werden dabei nicht mitgeklont, sondern nur parent und children. + * Returns a clone of this description. */ @SuppressWarnings("unchecked") @Override @@ -164,64 +108,27 @@ try { node = (Description) super.clone(); } catch (CloneNotSupportedException e) { - // this should never happen + // should never happen throw new InternalError(e.toString()); } - // parent kann man ev. auf null setzen bzw. testen, ob er null ist und - // in diesem Fall auf null setzen - // node.parent = (Node) parent.clone(); - // node.parent = null; - // eventuell sollte man jedes einzelne Kind durchgehen und klonen, da die clone() - // Methode von LinkedList nur eine "shallow copy" erzeugt - // node.children = (List<Node>) ((LinkedList)children).clone(); - // List<Node> childList = new LinkedList<Node>(); - - // Die Kopie des Knotens wird folgenderma�en angelegt: Zuerst wird mit - // super.clone() ein Klon des Knotens erstellt. Dabei handelt es sich um - // eine flache Kopie, d.h. bei nichtprimitiven Objekten wird einfach auf - // das gleiche Objekt gezeigt. Bei der Liste von Kindern ist das nicht - // erw�nscht. Es ist auch nicht m�glich nur clone() auf der Kinderliste - // selbst aufzurufen, weil dabei nur die Liste und nich die Elemente der Liste - // geklont werden. Aus dem Grund wird eine komplett neue Kinderliste erzeugt - // und dort die Knoten eingef�gt, die zuvor geklont werden. Durch aufrufen von - // addChild wird auch sichergestellt, dass der parent-Link auf den geklonten - // Knoten zeigt. + + // Create a deep copy, i.e. we iterate over all children and clone them. + // The addChild operation is used to ensure that the parent links are + // correct, i.e. all parent links point to the new clones instead of the + // old descriptions. node.children = new LinkedList<Description>(); for(Description child : children) { Description clonedChild = (Description) child.clone(); node.addChild(clonedChild); } - // Beim durchlaufen des Algorithmus werden posSet und negSet ge�ndert. Es ist - // nicht erw�nscht, dass sich diese Mengen, dann auch in anderen B�umen - // �ndern, da diese mittlerweile durch Crossover, Mutation etc. ge�ndert - // worden sein k�nnten. Momentan ist das nicht von Bedeutung (man k�nnte also - // die beiden folgenden Zeilen auch weglassen), da immer nur eine baumweise - // Abarbeitung des Algorithmus erfolgt und diese Mengen nicht wiederverwendet - // werden. - //node.posSet = new TreeSet<String>(); - //node.negSet = new TreeSet<String>(); return node; } - /* - protected Set<String> getPosSet() { - return posSet; - } - - protected Set<String> getNegSet() { - return negSet; - } - */ - - /* - public Concept getChildren(int index) { - return children.get(index); - } - */ - /** - * Adds child and sets this node as parent. + * Adds a description as child of this one. The parent link + * of the concept will point to this one. + * * @param child * @return */ @@ -231,7 +138,9 @@ } /** - * Adds child and sets this node as parent. + * Adds a child description at the specified index. + * + * @see #addChild(Description) * @param index * @param child */ @@ -240,15 +149,21 @@ children.add(index, child); } - // relativ neue Methode + /** + * Remove the specified child description (its parent link is set + * to null). + * @param child The child to remove. + */ public void removeChild(Description child) { child.setParent(null); children.remove(child); } /** - * Tests if this node is the root of a tree. - * @return True if this node is the root of a program tree, false otherwise. + * Tests whether this description is at the root, i.e. + * does not have a parent. + * + * @return True if this node is the root of a description, false otherwise. */ public boolean isRoot() { return (parent == null); @@ -275,5 +190,14 @@ return toString(null, null); } + /** + * Returns a manchester syntax string of this description. For a + * reference, see + * <a href="http://www.co-ode.org/resources/reference/manchester_syntax">here</a> + * and <a href="http://owl-workshop.man.ac.uk/acceptedLong/submission_9.pdf">here</a> (PDF). + * @return The manchester syntax string for this description. + */ + public abstract String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes); + public abstract void accept(DescriptionVisitor visitor); } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Individual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Individual.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/Individual.java 2008-02-17 13:08:46 UTC (rev 590) @@ -60,7 +60,7 @@ } public String toString(String baseURI, Map<String,String> prefixes) { - return Helper.getAbbreviatedString(name, baseURI, prefixes); + return "\"" + Helper.getAbbreviatedString(name, baseURI, prefixes) + "\""; } public void accept(KBElementVisitor visitor) { Modified: trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/Intersection.java 2008-02-17 13:08:46 UTC (rev 590) @@ -46,6 +46,23 @@ return ret; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString() + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + if(children.size()==0) + return "EMPTY_AND"; + + String ret = "("; + for(int i=0; i<children.size()-1; i++) { + ret += children.get(i).toManchesterSyntaxString(baseURI, prefixes) + " and "; + } + ret += children.get(children.size()-1).toManchesterSyntaxString(baseURI, prefixes) + ")"; + return ret; + } + + @Deprecated public String toStringOld() { String ret = "MULTI_AND ["; for(Description child : children) { @@ -65,5 +82,7 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); - } + } + + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-02-17 13:08:46 UTC (rev 590) @@ -57,7 +57,7 @@ } public String toString(String baseURI, Map<String,String> prefixes) { - return Helper.getAbbreviatedString(name, baseURI, prefixes); + return "\"" + Helper.getAbbreviatedString(name, baseURI, prefixes) + "\""; } /* (non-Javadoc) @@ -70,5 +70,13 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return Helper.getAbbreviatedString(name, baseURI, prefixes); } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Negation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Negation.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/Negation.java 2008-02-17 13:08:46 UTC (rev 590) @@ -41,5 +41,13 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return "(not " +children.get(0).toString(baseURI, prefixes) + ")"; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/Nothing.java 2008-02-17 13:08:46 UTC (rev 590) @@ -18,6 +18,15 @@ return "BOTTOM"; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO: check whether this is correct + return "owl:Nothing"; + } + public int getLength() { return 1; } @@ -37,5 +46,7 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); - } + } + + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectAllRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.owl; import java.util.Map; @@ -2,3 +21,9 @@ - +/** + * All quantified restriction on objects, e.g. \forall hasChild.description + * stands for all objects having only children satisfying description. + * + * @author Jens Lehmann + * + */ public class ObjectAllRestriction extends ObjectQuantorRestriction { @@ -8,93 +33,15 @@ public ObjectAllRestriction(ObjectPropertyExpression role, Description c) { super(role, c); } - - /* - public All(String roleName) { - this.roleName = roleName; - } - - public String getRoleName() { - return roleName; - } - */ - - /* - @Override - protected void calculateSets(FlatABox abox, SortedSet<String> adcPosSet, SortedSet<String> adcNegSet) { - children.get(0).calculateSets(abox, posSet, negSet); - - // Daten zu R+ und R- - Map<String, SortedSet<String>> rplus = abox.rolesPos.get(roleName); - Map<String, SortedSet<String>> rminus = abox.rolesNeg.get(roleName); - // Daten zu C und C+ - Set<String> cPlus = children.get(0).posSet; - Set<String> cMinus = children.get(0).negSet; - - // Fallunterscheidungen einbauen, da R+ und R- leer sein können - // und es nicht für jedes a der Domain ein (a,b) \in R+ bzw. R- geben muss; - // man beachte, dass viele Regeln nur gelten, weil als Domain die Menge aller - // Individuen angenommen wird! - - // R- ist leer - if(rminus==null) { - // falls C die ganze Domain umfasst, dann erüllt jedes Individual - // All R.C, ansonsten keines (es muss nichts gemacht werden) - if(cPlus.equals(abox.domain)) - // keine Kopie notwendig, da Domain unveränderlich - posSet = abox.domain; - } else { - for (String a : abox.domain) { - if(!rminus.containsKey(a)) { - // a erfüllt die Bedingung, falls alle b in C+ sind - if(cPlus.equals(abox.domain)) - posSet.add(a); - } - else if (checkAll(Helper.difference(abox.domain, rminus.get(a)), cPlus)) - posSet.add(a); - } - } - - // falls R+ leer ist, dann ist Bedingung nie erfüllt - if(rplus!=null) { - for (String a : rplus.keySet()) { - // falls R+ Schlüssel nicht enthält, ist Bedingung nicht erfüllt - if (rplus.containsKey(a) && checkExist(rplus.get(a), cMinus)) - negSet.add(a); - } - } - - - - } - - // aus Exists-Klasse übernommen - private static boolean checkExist(Set<String> s1, Set<String> s2) { - for (String b : s1) { - if (s2.contains(b)) - return true; - } - return false; - } - - private static boolean checkAll(Set<String> s1, Set<String> s2) { - for (String b : s1) { - if (!s2.contains(b)) - return false; - } - return true; - } - */ - + public String toString(String baseURI, Map<String,String> prefixes) { return "ALL " + role + "." + children.get(0).toString(baseURI, prefixes); } - - /* - public int getLength() { - return 2; - } - */ + + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return role.toString(baseURI, prefixes) + " some " + children.get(0).toManchesterSyntaxString(baseURI, prefixes); + } /* (non-Javadoc) * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) @@ -106,5 +53,5 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); - } + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectExactCardinalityRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -40,6 +40,11 @@ return "= " + number + " " + role.toString(baseURI, prefixes) + " " + getChild(0).toString(baseURI, prefixes); } + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return role.toString(baseURI, prefixes) + " exactly " + number + " " + getChild(0).toManchesterSyntaxString(baseURI, prefixes); + } + /* (non-Javadoc) * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) */ @@ -50,5 +55,6 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); - } + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectMaxCardinalityRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -17,6 +17,11 @@ return "<= " + number + " " + role.toString(baseURI, prefixes) + " " + getChild(0).toString(baseURI, prefixes); } + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return role.toString(baseURI, prefixes) + " max " + number + " " + getChild(0).toManchesterSyntaxString(baseURI, prefixes); + } + /* (non-Javadoc) * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) */ Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectMinCardinalityRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -17,6 +17,11 @@ return ">= " + number + " " + role.toString(baseURI, prefixes) + " " + getChild(0).toString(baseURI, prefixes); } + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return role.toString(baseURI, prefixes) + " min " + number + " " + getChild(0).toManchesterSyntaxString(baseURI, prefixes); + } + /* (non-Javadoc) * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) */ Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-02-17 13:08:46 UTC (rev 590) @@ -44,11 +44,11 @@ public String toString() { return name; } + + public String toString(String baseURI, Map<String,String> prefixes) { + return "\"" + Helper.getAbbreviatedString(name, baseURI, prefixes) + "\""; + } - public String toString(String baseURI, Map<String,String> prefixes) { - return Helper.getAbbreviatedString(name, baseURI, prefixes); - } - public void accept(KBElementVisitor visitor) { visitor.visit(this); } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectSomeRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.owl; import java.util.Map; @@ -2,3 +21,8 @@ - +/** + * Existantial restriction on objects, e.g. \exists hasChild.Male. + * + * @author Jens Lehmann + * + */ public class ObjectSomeRestriction extends ObjectQuantorRestriction { @@ -9,93 +33,14 @@ super(role,c); } - /* - public Exists(String roleName) { - this.roleName = roleName; - } - - public String getRoleName() { - return roleName; - } - */ - - /* - @Override - protected void calculateSets(FlatABox abox, SortedSet<String> adcPosSet, SortedSet<String> adcNegSet) { - children.get(0).calculateSets(abox, posSet, negSet); - - // Daten zu R+ - Map<String, SortedSet<String>> rplus = abox.rolesPos.get(roleName); - Map<String, SortedSet<String>> rminus = abox.rolesNeg.get(roleName); - // Daten zu C und C+ - Set<String> cPlus = children.get(0).posSet; - Set<String> cMinus = children.get(0).negSet; - - // es wird r(a,b) untersucht und sobald ein b mit b \in C+ gefunden - // wird, wird a in posSet aufgenommen - - if(rplus!=null) { - for (String a : rplus.keySet()) { - if (rplus.containsKey(a) && checkExist(rplus.get(a), cPlus)) - posSet.add(a); - } - } - - - // ich muss über die ganze Domain gehen: selbst wenn für ein a gar kein - // (a,b) in R- existiert, dann kann so ein a trotzdem die Bedingung erfüllen - - if(rminus==null) { - if(cMinus.equals(abox.domain)) - negSet = abox.domain; - } else { - for (String a : abox.domain) { - if(!rminus.containsKey(a)) { - if(cMinus.equals(abox.domain)) - negSet.add(a); - } else - if (checkAll(Helper.difference(abox.domain, rminus.get(a)), cMinus)) - negSet.add(a); - } - } - - } - - // check-Methoden: hier ist s1 jeweils immer die Menge aller b, die für - // ein festes a in den - // Updategleichungen die erste Bedingung erfüllen (z.B. alle b - // mit (a,b) \not\in R-) und s2 die Menge, die die zweite Bedingung erfüllt - - // gibt true zurück, falls es ein b gibt mit b \in s1 und b \in s2, - // ansonsten false - private static boolean checkExist(Set<String> s1, Set<String> s2) { - for (String b : s1) { - if (s2.contains(b)) - return true; - } - return false; - } - - // gibt false zurück, falls für ein b \in s1 gilt b \in s2, - // ansonsten true - private static boolean checkAll(Set<String> s1, Set<String> s2) { - for (String b : s1) { - if (!s2.contains(b)) - return false; - } - return true; - } - */ - public String toString(String baseURI, Map<String,String> prefixes) { return "EXISTS " + role.toString(baseURI, prefixes) + "." + children.get(0).toString(baseURI, prefixes); } - /* - public int getLength() { - return 2; - } - */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return role.toString(baseURI, prefixes) + " only " + children.get(0).toManchesterSyntaxString(baseURI, prefixes); + } /* (non-Javadoc) * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor) Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2008-02-17 13:08:46 UTC (rev 590) @@ -19,6 +19,8 @@ */ package org.dllearner.core.owl; +import java.util.Map; + /** * Restricts the value of an object property to a single individual * (corresponds to owl:hasValue). @@ -38,5 +40,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.Description#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Thing.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Thing.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/Thing.java 2008-02-17 13:08:46 UTC (rev 590) @@ -16,6 +16,11 @@ return "TOP"; } + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return "owl:Thing"; + } + public int getLength() { return 1; } @@ -35,5 +40,7 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); - } + } + + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Union.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Union.java 2008-02-17 11:18:26 UTC (rev 589) +++ trunk/src/dl-learner/org/dllearner/core/owl/Union.java 2008-02-17 13:08:46 UTC (rev 590) @@ -48,6 +48,19 @@ return ret; } + @Override + public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { + if(children.size()==0) + return "EMPTY_OR"; + + String ret = "("; + for(int i=0; i<children.size()-1; i++) { + ret += children.get(i).toManchesterSyntaxString(baseURI, prefixes) + " or "; + } + ret += children.get(children.size()-1).toManchesterSyntaxString(baseURI, prefixes) + ")"; + return ret; + } + public String toStringOld() { String ret = "MULTI_OR ["; for(Description child : children) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-17 18:09:40
|
Revision: 593 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=593&view=rev Author: jenslehmann Date: 2008-02-17 10:09:32 -0800 (Sun, 17 Feb 2008) Log Message: ----------- minor output changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/cli/Start.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-02-17 17:30:58 UTC (rev 592) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-02-17 18:09:32 UTC (rev 593) @@ -115,6 +115,10 @@ // Variablen zur Einstellung der Protokollierung // boolean quiet = false; boolean showBenchmarkInformation = false; + // the previous best node (used only for logging, such that we can + // detect whether a new best node has been found since the last time + // statistics were printed) + private Node previousBestNode; // boolean createTreeString = false; // String searchTree = new String(); TreeSet<Node> expandedNodes = new TreeSet<Node>(nodeComparatorStable); @@ -865,10 +869,20 @@ long algorithmRuntime = System.nanoTime() - algorithmStartTime; if(!finalStats) { + Node bestNode = candidatesStable.last(); + boolean newBestNodeFound = false; + if(!bestNode.equals(previousBestNode)) { + newBestNodeFound = true; + previousBestNode = bestNode; + } + if(newBestNodeFound) + logger.info("currently best node: " + bestNode); + // Refinementoperator auf Konzept anwenden String bestNodeString = "currently best node: " + candidatesStable.last(); // searchTree += bestNodeString + "\n"; - logger.info(bestNodeString); + if(!newBestNodeFound) + logger.debug(bestNodeString); String expandedNodeString = "next expanded node: " + candidates.last(); // searchTree += expandedNodeString + "\n"; logger.debug(expandedNodeString); Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 17:30:58 UTC (rev 592) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-17 18:09:32 UTC (rev 593) @@ -231,27 +231,8 @@ // perform file exports performExports(parser, baseDir, sources, rs); - // show examples (display each one if they do not take up much space, - // otherwise just show the number of examples) - boolean oneLineExampleInfo = true; - int maxExampleStringLength = Math.max(posExamples.toString().length(), negExamples - .toString().length()); - if (maxExampleStringLength > 100) - oneLineExampleInfo = false; - if (oneLineExampleInfo) { - System.out.println("positive examples[" + posExamples.size() + "]: " + posExamples); - System.out.println("negative examples[" + negExamples.size() + "]: " + negExamples); - } else { - System.out.println("positive examples[" + posExamples.size() + "]: "); - for (String ex : posExamples) - System.out.println(" " + ex); - System.out.println("negative examples[" + negExamples.size() + "]: "); - for (String ex : negExamples) - System.out.println(" " + ex); - } - // handle any CLI options - processCLIOptions(cm, parser, rs); + processCLIOptions(cm, parser, rs, lp); } public void start(boolean inQueryMode) { @@ -479,7 +460,7 @@ } private static void processCLIOptions(ComponentManager cm, ConfParser parser, - ReasoningService rs) { + ReasoningService rs, LearningProblem lp) { // CLI options (i.e. options which are related to the CLI // user interface but not to one of the components) List<ConfFileOption> cliOptions = parser.getConfOptionsByPrefix("cli"); @@ -487,7 +468,28 @@ int maxLineLength = 100; for (ConfFileOption cliOption : cliOptions) { String name = cliOption.getSubOption(); - if (name.equals("showIndividuals")) { + if (name.equals("showExamples")) { + // show examples (display each one if they do not take up much space, + // otherwise just show the number of examples) + SortedSet<String> posExamples = parser.getPositiveExamples(); + SortedSet<String> negExamples = parser.getNegativeExamples(); + boolean oneLineExampleInfo = true; + int maxExampleStringLength = Math.max(posExamples.toString().length(), negExamples + .toString().length()); + if (maxExampleStringLength > 100) + oneLineExampleInfo = false; + if (oneLineExampleInfo) { + System.out.println("positive examples[" + posExamples.size() + "]: " + posExamples); + System.out.println("negative examples[" + negExamples.size() + "]: " + negExamples); + } else { + System.out.println("positive examples[" + posExamples.size() + "]: "); + for (String ex : posExamples) + System.out.println(" " + ex); + System.out.println("negative examples[" + negExamples.size() + "]: "); + for (String ex : negExamples) + System.out.println(" " + ex); + } + } else if (name.equals("showIndividuals")) { if (cliOption.getStringValue().equals("true")) { int stringLength = rs.getIndividuals().toString().length(); if (stringLength > maxLineLength) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-18 18:54:41
|
Revision: 606 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=606&view=rev Author: jenslehmann Date: 2008-02-18 10:53:32 -0800 (Mon, 18 Feb 2008) Log Message: ----------- - started jUnit reasoner tests - small addition to KBparser Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/parser/KBParser.java trunk/src/dl-learner/org/dllearner/parser/kb.jj trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-18 17:28:12 UTC (rev 605) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-18 18:53:32 UTC (rev 606) @@ -60,6 +60,18 @@ private URL url; private KB kb; + /** + * Constructor allowing you to treat an already existing KB object + * as a KBFile knowledge source. Use it sparingly, because the + * standard way to create components is via + * {@link org.dllearner.core.ComponentManager}. + * + * @param kb A KB object. + */ + public KBFile(KB kb) { + this.kb = kb; + } + public static String getName() { return "KB file"; } @@ -99,7 +111,8 @@ @Override public void init() throws ComponentInitException { try { - kb = KBParser.parseKBFile(url); + if(kb == null) + kb = KBParser.parseKBFile(url); } catch (IOException e) { throw new ComponentInitException("KB file " + url + " could not be read.", e); } catch (ParseException e) { Modified: trunk/src/dl-learner/org/dllearner/parser/KBParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-18 17:28:12 UTC (rev 605) +++ trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-18 18:53:32 UTC (rev 606) @@ -23,6 +23,11 @@ return parser.Concept(); } + public static KB parseKBFile(String content) throws IOException, ParseException { + KBParser parser = new KBParser(new StringReader(content)); + return parser.KB(); + } + public static KB parseKBFile(URL url) throws IOException, ParseException { KBParser parser = new KBParser(url.openStream()); return parser.KB(); @@ -494,31 +499,6 @@ finally { jj_save(5, xla); } } - final private boolean jj_3R_13() { - if (jj_scan_token(19)) return true; - if (jj_3R_20()) return true; - if (jj_3R_4()) return true; - if (jj_scan_token(COMMAND_END)) return true; - if (jj_3R_2()) return true; - return false; - } - - final private boolean jj_3R_22() { - if (jj_scan_token(STRING)) return true; - return false; - } - - final private boolean jj_3_2() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(18)) jj_scanpos = xsp; - if (jj_3R_4()) return true; - if (jj_scan_token(22)) return true; - if (jj_3R_3()) return true; - if (jj_scan_token(24)) return true; - return false; - } - final private boolean jj_3_6() { if (jj_scan_token(22)) return true; if (jj_3R_2()) return true; @@ -727,6 +707,31 @@ return false; } + final private boolean jj_3R_13() { + if (jj_scan_token(19)) return true; + if (jj_3R_20()) return true; + if (jj_3R_4()) return true; + if (jj_scan_token(COMMAND_END)) return true; + if (jj_3R_2()) return true; + return false; + } + + final private boolean jj_3R_22() { + if (jj_scan_token(STRING)) return true; + return false; + } + + final private boolean jj_3_2() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(18)) jj_scanpos = xsp; + if (jj_3R_4()) return true; + if (jj_scan_token(22)) return true; + if (jj_3R_3()) return true; + if (jj_scan_token(24)) return true; + return false; + } + public KBParserTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; Modified: trunk/src/dl-learner/org/dllearner/parser/kb.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-18 17:28:12 UTC (rev 605) +++ trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-18 18:53:32 UTC (rev 606) @@ -52,6 +52,11 @@ return parser.Concept(); } + public static KB parseKBFile(String content) throws IOException, ParseException { + KBParser parser = new KBParser(new StringReader(content)); + return parser.KB(); + } + public static KB parseKBFile(URL url) throws IOException, ParseException { KBParser parser = new KBParser(url.openStream()); return parser.KB(); Added: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-02-18 18:53:32 UTC (rev 606) @@ -0,0 +1,105 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.reasoning; + +import java.util.Set; +import java.util.SortedSet; + +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; + +/** + * @author Jens Lehmann + * + */ +public class FastInstanceChecker extends ReasonerComponent { + + /* (non-Javadoc) + * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.config.ConfigEntry) + */ + @Override + public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.Component#init() + */ + @Override + public void init() throws ComponentInitException { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.dllearner.core.Reasoner#getAtomicConcepts() + */ + public Set<NamedClass> getAtomicConcepts() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.Reasoner#getAtomicRoles() + */ + public Set<ObjectProperty> getAtomicRoles() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.Reasoner#getIndividuals() + */ + public SortedSet<Individual> getIndividuals() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.Reasoner#getReasonerType() + */ + public ReasonerType getReasonerType() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.dllearner.core.Reasoner#prepareSubsumptionHierarchy(java.util.Set) + */ + public void prepareSubsumptionHierarchy(Set<NamedClass> allowedConcepts) { + // TODO Auto-generated method stub + + } + + /** + * @param args + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + + } + +} Modified: trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java 2008-02-18 17:28:12 UTC (rev 605) +++ trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java 2008-02-18 18:53:32 UTC (rev 606) @@ -33,7 +33,8 @@ public class AllTestsRunner { public static void main(String[] args) { - JUnitCore.main("org.dllearner.test.ComponentTests"); + JUnitCore.main("org.dllearner.test.junit.ComponentTests", + "org.dllearner.test.junit.ReasonerTests"); } } Added: trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2008-02-18 18:53:32 UTC (rev 606) @@ -0,0 +1,87 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.test.junit; + +import java.io.IOException; + +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.ReasoningMethodUnsupportedException; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.KB; +import org.dllearner.kb.KBFile; +import org.dllearner.parser.KBParser; +import org.dllearner.parser.ParseException; +import org.dllearner.reasoning.FastInstanceChecker; +import org.dllearner.reasoning.OWLAPIReasoner; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * A suite of JUnit tests related to the DL-Learner reasoning. + * + * @author Jens Lehmann + * + */ +public class ReasonerTests { + + private KB getSimpleKnowledgeBase() { + String kb = "person SUB TOP."; + kb += "man SUB person."; + kb += "woman SUB person."; + KB kbObject = null; + try { + kbObject = KBParser.parseKBFile(kb); + } catch (IOException e) { + e.printStackTrace(); + } catch (ParseException e) { + e.printStackTrace(); + } + return kbObject; + } + + @Test + public void instanceCheckTest() { + try { + ComponentManager cm = ComponentManager.getInstance(); + KB kb = getSimpleKnowledgeBase(); + KnowledgeSource ks = new KBFile(kb); + ks.init(); + ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, ks); + reasoner.init(); + Description d; + d = KBParser.parseConcept("man"); + Individual i = new Individual("alex"); + boolean result = reasoner.instanceCheck(d, i); + assertFalse(result); + } catch (ParseException e) { + e.printStackTrace(); + } catch (ReasoningMethodUnsupportedException e) { + e.printStackTrace(); + } catch (ComponentInitException e) { + e.printStackTrace(); + } + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-19 12:06:28
|
Revision: 609 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=609&view=rev Author: jenslehmann Date: 2008-02-19 04:05:53 -0800 (Tue, 19 Feb 2008) Log Message: ----------- OWL API reasoner now supports KB files Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/kb/OWLFile.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java trunk/src/dl-learner/org/dllearner/utilities/OntologyClassRewriter.java Modified: trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java 2008-02-19 12:05:53 UTC (rev 609) @@ -22,6 +22,8 @@ import java.io.File; import java.net.URI; +import org.dllearner.core.owl.KB; + /** * Represents a knowledge source component. * @@ -30,6 +32,8 @@ */ public abstract class KnowledgeSource extends Component { + public abstract KB toKB(); + public abstract String toDIG(URI kbURI); public abstract void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException; Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-19 12:05:53 UTC (rev 609) @@ -37,7 +37,7 @@ import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; import org.dllearner.reasoning.DIGConverter; -import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.reasoning.OWLAPIAxiomConvertVisitor; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyCreationException; @@ -148,7 +148,8 @@ OWLOntology ontology; try { ontology = manager.createOntology(ontologyURI); - OWLAPIReasoner.fillOWLAPIOntology(manager,ontology,kb); + // OWLAPIReasoner.fillOWLAPIOntology(manager,ontology,kb); + OWLAPIAxiomConvertVisitor.fillOWLOntology(manager, ontology, kb); manager.saveOntology(ontology); } catch (OWLOntologyCreationException e) { // TODO Auto-generated catch block @@ -186,5 +187,10 @@ public URL getURL() { return url; } + + @Override + public KB toKB() { + return kb; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/OWLFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-02-19 12:05:53 UTC (rev 609) @@ -33,6 +33,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.owl.KB; import org.dllearner.reasoning.OWLAPIDIGConverter; /** @@ -107,4 +108,12 @@ throw new OntologyFormatUnsupportedException("export", format); } + /* (non-Javadoc) + * @see org.dllearner.core.KnowledgeSource#toKB() + */ + @Override + public KB toKB() { + throw new Error("OWL -> KB conversion not implemented yet."); + } + } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-02-19 12:05:53 UTC (rev 609) @@ -396,6 +396,15 @@ return new SparqlQueryThreaded(new Cache("cache"),this.sparqlQuery(query)); } + /* (non-Javadoc) + * @see org.dllearner.core.KnowledgeSource#toKB() + */ + @Override + public KB toKB() { + // TODO Does this work? + return kb; + } + /*public static void main(String[] args) throws MalformedURLException { String query = "SELECT ?pred ?obj\n" + "WHERE {<http://dbpedia.org/resource/Leipzig> ?pred ?obj}"; Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-19 12:05:53 UTC (rev 609) @@ -79,7 +79,7 @@ this.ontology = ontology; factory = manager.getOWLDataFactory(); } - + public static void fillOWLOntology(OWLOntologyManager manager, OWLOntology ontology, KB kb) { OWLAPIAxiomConvertVisitor converter = new OWLAPIAxiomConvertVisitor(manager, ontology, kb); for(Axiom axiom : kb.getTbox()) Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-19 12:05:53 UTC (rev 609) @@ -99,6 +99,9 @@ */ public class OWLAPIReasoner extends ReasonerComponent { +// private static Logger logger = Logger +// .getLogger(OWLAPIReasoner.class); + private String reasonerType = "pellet"; private Set<KnowledgeSource> sources; @@ -167,19 +170,11 @@ Set<OWLOntology> allImports = new HashSet<OWLOntology>(); for(KnowledgeSource source : sources) { - if(!(source instanceof OWLFile)) { - System.out.println("Currently, only OWL files are supported. Ignoring knowledge source " + source + "."); - } else { + // OWL files are read directly + if(source instanceof OWLFile) { URL url = ((OWLFile)source).getURL(); - /* + try { - url = new URL("http://www.co-ode.org/ontologies/pizza/2007/02/12/pizza.owl"); - } catch (MalformedURLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - */ - try { OWLOntology ontology = manager.loadOntologyFromPhysicalURI(url.toURI()); allImports.addAll(manager.getImportsClosure(ontology)); classes.addAll(ontology.getReferencedClasses()); @@ -193,6 +188,18 @@ } catch (URISyntaxException e) { e.printStackTrace(); } + // all other sources are converted to KB and then to an + // OWL API ontology + } else { + KB kb = source.toKB(); + URI ontologyURI = URI.create("http://example.com"); + OWLOntology ontology = null; + try { + ontology = manager.createOntology(ontologyURI); + } catch (OWLOntologyCreationException e) { + e.printStackTrace(); + } + OWLAPIAxiomConvertVisitor.fillOWLOntology(manager, ontology, kb); } } @@ -221,9 +228,9 @@ e1.printStackTrace(); }*/ - System.out.println(classes); - System.out.println(properties); - System.out.println(individuals); +// System.out.println(classes); +// System.out.println(properties); +// System.out.println(individuals); // compute class hierarchy and types of individuals // (done here to speed up later reasoner calls) @@ -239,15 +246,15 @@ - try { - if(reasoner.isDefined(factory.getOWLIndividual(URI.create("http://example.com/father#female")))) - System.out.println("DEFINED."); - else - System.out.println("NOT DEFINED."); - } catch (OWLReasonerException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } +// try { +// if(reasoner.isDefined(factory.getOWLIndividual(URI.create("http://example.com/father#female")))) +// System.out.println("DEFINED."); +// else +// System.out.println("NOT DEFINED."); +// } catch (OWLReasonerException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } // read in primitives atomicConcepts = new TreeSet<NamedClass>(conceptComparator); Modified: trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2008-02-19 12:05:53 UTC (rev 609) @@ -32,7 +32,6 @@ import org.dllearner.kb.KBFile; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; -import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; import org.junit.Test; Modified: trunk/src/dl-learner/org/dllearner/utilities/OntologyClassRewriter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/OntologyClassRewriter.java 2008-02-18 19:20:47 UTC (rev 608) +++ trunk/src/dl-learner/org/dllearner/utilities/OntologyClassRewriter.java 2008-02-19 12:05:53 UTC (rev 609) @@ -27,7 +27,7 @@ import org.dllearner.core.owl.Description; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; -import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.reasoning.OWLAPIDescriptionConvertVisitor; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; @@ -71,7 +71,8 @@ // umwandeln in interne KAON2-Darstellung (bereits im DL-Learner implementiert) // Description newConceptKAON2 = KAON2Reasoner.getKAON2Description(newConceptInternal); - OWLDescription newConceptOWLAPI = OWLAPIReasoner.getOWLAPIDescription(newConceptInternal); + // OWLDescription newConceptOWLAPI = OWLAPIReasoner.getOWLAPIDescription(newConceptInternal); + OWLDescription newConceptOWLAPI = OWLAPIDescriptionConvertVisitor.getOWLDescription(newConceptInternal); // Umwandlung Klassenname in atomate KAON2-Klasse // OWLClass classKAON2 = KAON2Manager.factory().owlClass(className); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-19 13:20:08
|
Revision: 610 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=610&view=rev Author: jenslehmann Date: 2008-02-19 05:20:01 -0800 (Tue, 19 Feb 2008) Log Message: ----------- extended jUnit reasoner test and fixed a bug which it revealed Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/KB.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java Modified: trunk/src/dl-learner/org/dllearner/core/owl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-02-19 12:05:53 UTC (rev 609) +++ trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-02-19 13:20:01 UTC (rev 610) @@ -106,6 +106,7 @@ for(String name : conceptNames) { ret.add(new NamedClass(name)); } + return ret; } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2008-02-19 12:05:53 UTC (rev 609) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2008-02-19 13:20:01 UTC (rev 610) @@ -21,10 +21,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.OutputStream; import java.nio.charset.Charset; import java.util.Iterator; import java.util.List; Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-19 12:05:53 UTC (rev 609) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-02-19 13:20:01 UTC (rev 610) @@ -118,9 +118,9 @@ private Set<Description> allowedConceptsInSubsumptionHierarchy; // primitives - Set<NamedClass> atomicConcepts; - Set<ObjectProperty> atomicRoles; - SortedSet<Individual> individuals; + Set<NamedClass> atomicConcepts = new TreeSet<NamedClass>(conceptComparator); + Set<ObjectProperty> atomicRoles = new TreeSet<ObjectProperty>(roleComparator); + SortedSet<Individual> individuals = new TreeSet<Individual>(); public OWLAPIReasoner(Set<KnowledgeSource> sources) { this.sources = sources; @@ -179,9 +179,6 @@ allImports.addAll(manager.getImportsClosure(ontology)); classes.addAll(ontology.getReferencedClasses()); properties.addAll(ontology.getReferencedObjectProperties()); - // does not seem to work => workaround: query all instances of Top - // maybe one can also query for instances of OWLObjectProperty, - // OWLClass, OWLIndividual owlIndividuals.addAll(ontology.getReferencedIndividuals()); } catch (OWLOntologyCreationException e) { e.printStackTrace(); @@ -192,6 +189,8 @@ // OWL API ontology } else { KB kb = source.toKB(); +// System.out.println(kb.toString(null,null)); + URI ontologyURI = URI.create("http://example.com"); OWLOntology ontology = null; try { @@ -200,6 +199,10 @@ e.printStackTrace(); } OWLAPIAxiomConvertVisitor.fillOWLOntology(manager, ontology, kb); + allImports.add(ontology); + atomicConcepts.addAll(kb.findAllAtomicConcepts()); + atomicRoles.addAll(kb.findAllAtomicRoles()); + individuals.addAll(kb.findAllIndividuals()); } } @@ -214,6 +217,8 @@ // instantiate Pellet reasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); + // change log level to WARN for Pellet, because otherwise log + // output will be very large Logger pelletLogger = Logger.getLogger("org.mindswap.pellet"); pelletLogger.setLevel(Level.WARN); } @@ -257,13 +262,10 @@ // } // read in primitives - atomicConcepts = new TreeSet<NamedClass>(conceptComparator); for(OWLClass owlClass : classes) atomicConcepts.add(new NamedClass(owlClass.getURI().toString())); - atomicRoles = new TreeSet<ObjectProperty>(roleComparator); for(OWLObjectProperty owlProperty : properties) atomicRoles.add(new ObjectProperty(owlProperty.getURI().toString())); - individuals = new TreeSet<Individual>(); for(OWLIndividual owlIndividual : owlIndividuals) individuals.add(new Individual(owlIndividual.getURI().toString())); Modified: trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java 2008-02-19 12:05:53 UTC (rev 609) +++ trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java 2008-02-19 13:20:01 UTC (rev 610) @@ -19,6 +19,10 @@ */ package org.dllearner.test.junit; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.SimpleLayout; import org.junit.runner.JUnitCore; /** @@ -33,6 +37,15 @@ public class AllTestsRunner { public static void main(String[] args) { + + // create logger + SimpleLayout layout = new SimpleLayout(); + ConsoleAppender consoleAppender = new ConsoleAppender(layout); + Logger logger = Logger.getRootLogger(); + logger.removeAllAppenders(); + logger.addAppender(consoleAppender); + logger.setLevel(Level.INFO); + JUnitCore.main("org.dllearner.test.junit.ComponentTests", "org.dllearner.test.junit.ReasonerTests"); } Modified: trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2008-02-19 12:05:53 UTC (rev 609) +++ trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2008-02-19 13:20:01 UTC (rev 610) @@ -20,7 +20,9 @@ package org.dllearner.test.junit; import java.io.IOException; +import java.util.List; +import org.apache.log4j.Logger; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; @@ -32,7 +34,6 @@ import org.dllearner.kb.KBFile; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; -import org.dllearner.reasoning.OWLAPIReasoner; import org.junit.Test; import static org.junit.Assert.*; @@ -45,10 +46,18 @@ */ public class ReasonerTests { + private static Logger logger = Logger.getLogger(ReasonerTests.class); + private KB getSimpleKnowledgeBase() { String kb = "person SUB TOP."; kb += "man SUB person."; + kb += "man SUB male."; kb += "woman SUB person."; + kb += "woman SUB female."; + kb += "(male AND female) = BOTTOM."; + kb += "man(stephen)."; + kb += "woman(maria)."; + kb += "hasChild(stephen,maria)."; KB kbObject = null; try { kbObject = KBParser.parseKBFile(kb); @@ -60,6 +69,10 @@ return kbObject; } + /** + * Performs an instance checks on all reasoner components to verify that + * they all return the correct result. + */ @Test public void instanceCheckTest() { try { @@ -67,13 +80,18 @@ KB kb = getSimpleKnowledgeBase(); KnowledgeSource ks = new KBFile(kb); ks.init(); - ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, ks); - reasoner.init(); Description d; - d = KBParser.parseConcept("man"); - Individual i = new Individual("alex"); - boolean result = reasoner.instanceCheck(d, i); - assertFalse(result); + // d = KBParser.parseConcept("man"); + d = KBParser.parseConcept("(person AND EXISTS hasChild.female)"); + Individual i = new Individual(KBParser.getInternalURI("stephen")); + List<Class<? extends ReasonerComponent>> reasonerClasses = cm.getReasonerComponents(); + for (Class<? extends ReasonerComponent> reasonerClass : reasonerClasses) { + ReasonerComponent reasoner = cm.reasoner(reasonerClass, ks); + reasoner.init(); + boolean result = reasoner.instanceCheck(d, i); + logger.debug("instance check: " + reasoner + " " + d + " " + i + " " + result); + assertTrue(result); + } } catch (ParseException e) { e.printStackTrace(); } catch (ReasoningMethodUnsupportedException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-19 14:28:37
|
Revision: 611 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=611&view=rev Author: jenslehmann Date: 2008-02-19 06:28:23 -0800 (Tue, 19 Feb 2008) Log Message: ----------- - continued carcinogenesis mapper - fixed bug in KB file (relevant for component creation in ComponentManager) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-19 13:20:01 UTC (rev 610) +++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-19 14:28:23 UTC (rev 611) @@ -73,79 +73,77 @@ public class Carcinogenesis { private static URI ontologyURI = URI.create("http://dl-learner.org/carcinogenesis"); + + // directory of Prolog files + private static String prologDirectory = "examples/carcinogenesis/prolog/"; // mapping of symbols to names of chemical elements - private static Map<String,String> chemElements; - + private static Map<String, String> chemElements; + // types of atoms and bonds private static Set<String> atomTypes = new TreeSet<String>(); private static Set<String> bondTypes = new TreeSet<String>(); - + // we need a counter for bonds, because they are instances in OWL // but not in Prolog private static int bondNr = 0; - + /** * @param args * No arguments supported. + * @throws IOException + * @throws FileNotFoundException + * @throws ParseException */ - public static void main(String[] args) { + public static void main(String[] args) throws FileNotFoundException, IOException, + ParseException { - String prologDirectory = "examples/carcinogenesis/prolog/"; String[] files = new String[] { "ames.pl", "atoms.pl", "bonds.pl", "gentoxprops.pl", "ind_nos.pl", "ind_pos.pl", "newgroups.pl", // "train.b" => not a pure Prolog file but Progol/Aleph specific }; File owlFile = new File("examples/carcinogenesis/pte.owl"); - + Program program = null; long startTime, duration; String time; - try { - // reading files - System.out.print("Reading in carcinogenesis Prolog files ... "); - startTime = System.nanoTime(); - String content = ""; - for (String file : files) { - content += Files.readFile(new File(prologDirectory + file)); - } - duration = System.nanoTime() - startTime; - time = Helper.prettyPrintNanoSeconds(duration, false, false); - System.out.println("OK (" + time + ")."); - - // parsing files - System.out.print("Parsing Prolog files ... "); - startTime = System.nanoTime(); - PrologParser pp = new PrologParser(); - program = pp.parseProgram(content); - duration = System.nanoTime() - startTime; - time = Helper.prettyPrintNanoSeconds(duration, false, false); - System.out.println("OK (" + time + ")."); - } catch (ParseException e) { - e.printStackTrace(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); + // reading files + System.out.print("Reading in carcinogenesis Prolog files ... "); + startTime = System.nanoTime(); + String content = ""; + for (String file : files) { + content += Files.readFile(new File(prologDirectory + file)); } + duration = System.nanoTime() - startTime; + time = Helper.prettyPrintNanoSeconds(duration, false, false); + System.out.println("OK (" + time + ")."); + // parsing files + System.out.print("Parsing Prolog files ... "); + startTime = System.nanoTime(); + PrologParser pp = new PrologParser(); + program = pp.parseProgram(content); + duration = System.nanoTime() - startTime; + time = Helper.prettyPrintNanoSeconds(duration, false, false); + System.out.println("OK (" + time + ")."); + // prepare mapping - KB kb = new KB(); + KB kb = new KB(); createChemElementsMapping(); // create subclasses of atom NamedClass atomClass = getAtomicConcept("Atom"); - for(String element : chemElements.values()) { + for (String element : chemElements.values()) { NamedClass elClass = getAtomicConcept(element); SubClassAxiom sc = new SubClassAxiom(elClass, atomClass); kb.addAxiom(sc); } // define properties including domain and range // ... TODO ... - + // mapping clauses to axioms System.out.print("Mapping clauses to axioms ... "); - startTime = System.nanoTime(); + startTime = System.nanoTime(); ArrayList<Clause> clauses = program.getClauses(); for (Clause clause : clauses) { List<Axiom> axioms = mapClause(clause); @@ -154,7 +152,7 @@ } duration = System.nanoTime() - startTime; time = Helper.prettyPrintNanoSeconds(duration, false, false); - System.out.println("OK (" + time + ")."); + System.out.println("OK (" + time + ")."); // writing generated knowledge base System.out.print("Writing OWL file ... "); @@ -162,7 +160,27 @@ OWLAPIReasoner.exportKBToOWL(owlFile, kb, ontologyURI); duration = System.nanoTime() - startTime; time = Helper.prettyPrintNanoSeconds(duration, false, false); - System.out.println("OK (" + time + ")."); + System.out.println("OK (" + time + ")."); + + // generating conf files + File confTrainFile = new File("examples/carcinogenesis/train.conf"); + String confHeader = ""; + Files.appendFile(confTrainFile, confHeader); + + // generating training examples + File trainingFilePositives = new File(prologDirectory + "train.f"); + File trainingFileNegatives = new File(prologDirectory + "train.n"); + + List<Individual> posTrainExamples = getExamples(trainingFilePositives); + List<Individual> negTrainExamples = getExamples(trainingFileNegatives); + appendPosExamples(confTrainFile, posTrainExamples); + appendNegExamples(confTrainFile, negTrainExamples); + + // generating testExamples +// File confTestFile = new File("examples/carcinogenesis/test.conf"); +// File testFilePositives = new File(prologDirectory + "train.f"); +// File testFileNegatives = new File(prologDirectory + "train.n"); +// } private static List<Axiom> mapClause(Clause clause) { @@ -180,14 +198,14 @@ String type = head.getArgument(3).toPLString(); double charge = Double.parseDouble(head.getArgument(4).toPLString()); // relate compound and atom - ObjectPropertyAssertion ra = getRoleAssertion("hasAtom", compoundName, atomName); + ObjectPropertyAssertion ra = getRoleAssertion("hasAtom", compoundName, atomName); axioms.add(ra); // atom is made instance of the correct class String atomClass = getAtomClass(elementName, type); - ClassAssertionAxiom ca = getConceptAssertion(atomClass,atomName); + ClassAssertionAxiom ca = getConceptAssertion(atomClass, atomName); axioms.add(ca); // write subclass axiom if doesn't exist already - if(!atomTypes.contains(atomClass)) { + if (!atomTypes.contains(atomClass)) { NamedClass subClass = getAtomicConcept(atomClass); NamedClass superClass = getAtomicConcept(getFullElementName(elementName)); SubClassAxiom sc = new SubClassAxiom(subClass, superClass); @@ -195,9 +213,10 @@ atomTypes.add(atomClass); } // charge of atom - DatatypePropertyAssertion dpa = getDoubleDatatypePropertyAssertion(atomName, "charge", charge); + DatatypePropertyAssertion dpa = getDoubleDatatypePropertyAssertion(atomName, "charge", + charge); axioms.add(dpa); - } else if(headName.equals("bond")) { + } else if (headName.equals("bond")) { String compoundName = head.getArgument(0).toPLString(); String atom1Name = head.getArgument(1).toPLString(); String atom2Name = head.getArgument(2).toPLString(); @@ -207,10 +226,10 @@ ObjectPropertyAssertion op = getRoleAssertion("hasBond", compoundName, "bond" + bondNr); axioms.add(op); // make Bond-X subclass of Bond if that hasn't been done already - if(!bondTypes.contains(bondClass)) { + if (!bondTypes.contains(bondClass)) { NamedClass subClass = getAtomicConcept(bondClass); SubClassAxiom sc = new SubClassAxiom(subClass, getAtomicConcept("Bond")); - axioms.add(sc); + axioms.add(sc); bondTypes.add(bondClass); } // make e.g. bond382 instance of Bond-3 @@ -226,46 +245,77 @@ // print clauses which are not supported yet System.out.println("unsupported clause"); System.out.println(clause.toPLString()); - System.out.println(clause); + System.out.println(clause); } return axioms; } + + // takes a *.f or *.n file as input and returns the + // contained examples + private static List<Individual> getExamples(File file) throws FileNotFoundException, IOException, ParseException { + String content = Files.readFile(new File(prologDirectory + file)); + PrologParser pp = new PrologParser(); + Program programPos = pp.parseProgram(content); + List<Individual> ret = new LinkedList<Individual>(); + for(Clause c : programPos.getClauses()) { + String example = c.getHead().getArgument(0).toPLString(); + ret.add(getIndividual(example)); + } + return ret; + } + private static void appendPosExamples(File file, List<Individual> examples) { + StringBuffer content = new StringBuffer(); + for(Individual example : examples) { + content.append("+\""+example.toString()+"\""); + } + Files.appendFile(file, content.toString()); + } + + private static void appendNegExamples(File file, List<Individual> examples) { + StringBuffer content = new StringBuffer(); + for(Individual example : examples) { + content.append("-\""+example.toString()+"\""); + } + Files.appendFile(file, content.toString()); + } + private static String getAtomClass(String element, String atomType) { return getFullElementName(element) + "-" + atomType; } - + private static ClassAssertionAxiom getConceptAssertion(String concept, String i) { Individual ind = getIndividual(i); NamedClass c = getAtomicConcept(concept); - return new ClassAssertionAxiom(c,ind); + return new ClassAssertionAxiom(c, ind); } - + private static ObjectPropertyAssertion getRoleAssertion(String role, String i1, String i2) { Individual ind1 = getIndividual(i1); Individual ind2 = getIndividual(i2); ObjectProperty ar = getRole(role); - return new ObjectPropertyAssertion(ar,ind1,ind2); + return new ObjectPropertyAssertion(ar, ind1, ind2); } - - private static DoubleDatatypePropertyAssertion getDoubleDatatypePropertyAssertion(String individual, String datatypeProperty, double value) { + + private static DoubleDatatypePropertyAssertion getDoubleDatatypePropertyAssertion( + String individual, String datatypeProperty, double value) { Individual ind = getIndividual(individual); DatatypeProperty dp = getDatatypeProperty(datatypeProperty); - return new DoubleDatatypePropertyAssertion(dp,ind,value); - } - + return new DoubleDatatypePropertyAssertion(dp, ind, value); + } + private static Individual getIndividual(String name) { return new Individual(ontologyURI + "#" + name); - } - + } + private static ObjectProperty getRole(String name) { return new ObjectProperty(ontologyURI + "#" + name); - } - + } + private static DatatypeProperty getDatatypeProperty(String name) { return new DatatypeProperty(ontologyURI + "#" + name); - } - + } + private static NamedClass getAtomicConcept(String name) { return new NamedClass(ontologyURI + "#" + name); } @@ -274,15 +324,15 @@ // return corresponding element or throw an error if it // is not in the list String result = chemElements.get(abbreviation); - if(result == null) + if (result == null) throw new Error("Unknown element " + abbreviation); else - return result; - } - + return result; + } + // create chemical element list private static void createChemElementsMapping() { - chemElements = new HashMap<String,String>(); + chemElements = new HashMap<String, String>(); chemElements.put("as", "Arsenic"); chemElements.put("ba", "Barium"); chemElements.put("br", "Bromine"); Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-19 13:20:01 UTC (rev 610) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-19 14:28:23 UTC (rev 611) @@ -61,6 +61,13 @@ private KB kb; /** + * Default constructor (needed for reflection in ComponentManager). + */ + public KBFile() { + + } + + /** * Constructor allowing you to treat an already existing KB object * as a KBFile knowledge source. Use it sparingly, because the * standard way to create components is via This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-19 16:45:32
|
Revision: 614 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=614&view=rev Author: jenslehmann Date: 2008-02-19 08:44:57 -0800 (Tue, 19 Feb 2008) Log Message: ----------- - example set for carcinogenesis PTE-1 extracted - first run indicates that OWL reasoners (at least Pellet) cannot handle reasoning requests in reasonable time (ontology currently contains approx. 65k triples) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-19 15:54:02 UTC (rev 613) +++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-19 16:44:57 UTC (rev 614) @@ -75,7 +75,7 @@ private static URI ontologyURI = URI.create("http://dl-learner.org/carcinogenesis"); // directory of Prolog files - private static String prologDirectory = "examples/carcinogenesis/prolog/"; + private static final String prologDirectory = "examples/carcinogenesis/prolog/"; // mapping of symbols to names of chemical elements private static Map<String, String> chemElements; @@ -163,10 +163,12 @@ System.out.println("OK (" + time + ")."); // generating conf files - File confTrainFile = new File("examples/carcinogenesis/train.conf"); - String confHeader = ""; + File confTrainFile = new File("examples/carcinogenesis/train.conf"); + Files.clearFile(confTrainFile); + String confHeader = "import(\"pte.owl\");\n\n"; + confHeader += "reasoner = owlAPI;\n"; Files.appendFile(confTrainFile, confHeader); - + // generating training examples File trainingFilePositives = new File(prologDirectory + "train.f"); File trainingFileNegatives = new File(prologDirectory + "train.n"); @@ -176,11 +178,21 @@ appendPosExamples(confTrainFile, posTrainExamples); appendNegExamples(confTrainFile, negTrainExamples); - // generating testExamples -// File confTestFile = new File("examples/carcinogenesis/test.conf"); -// File testFilePositives = new File(prologDirectory + "train.f"); -// File testFileNegatives = new File(prologDirectory + "train.n"); -// + // generating test examples for PTE-1 + File confPTE1File = new File("examples/carcinogenesis/testpte1.conf"); + Files.clearFile(confPTE1File); + File testPTE1Positives = new File(prologDirectory + "pte1.f"); + File testPTE1Negatives = new File(prologDirectory + "pte1.n"); + + List<Individual> posPTE1Examples = getExamples(testPTE1Positives); + List<Individual> negPTE1Examples = getExamples(testPTE1Negatives); + appendPosExamples(confPTE1File, posPTE1Examples); + appendNegExamples(confPTE1File, negPTE1Examples); + + // TODO: how to get PTE-2 predictions? the pte-2 directory suggests + // that all are positive which is not true (according to the papers) + // solution: go to "http://ntp-server.niehs.nih.gov/" and click + // on "Testing Status of Agents at NTP" } private static List<Axiom> mapClause(Clause clause) { @@ -253,7 +265,7 @@ // takes a *.f or *.n file as input and returns the // contained examples private static List<Individual> getExamples(File file) throws FileNotFoundException, IOException, ParseException { - String content = Files.readFile(new File(prologDirectory + file)); + String content = Files.readFile(file); PrologParser pp = new PrologParser(); Program programPos = pp.parseProgram(content); List<Individual> ret = new LinkedList<Individual>(); @@ -267,7 +279,7 @@ private static void appendPosExamples(File file, List<Individual> examples) { StringBuffer content = new StringBuffer(); for(Individual example : examples) { - content.append("+\""+example.toString()+"\""); + content.append("+\""+example.toString()+"\"\n"); } Files.appendFile(file, content.toString()); } @@ -275,7 +287,7 @@ private static void appendNegExamples(File file, List<Individual> examples) { StringBuffer content = new StringBuffer(); for(Individual example : examples) { - content.append("-\""+example.toString()+"\""); + content.append("-\""+example.toString()+"\"\n"); } Files.appendFile(file, content.toString()); } Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-19 15:54:02 UTC (rev 613) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-02-19 16:44:57 UTC (rev 614) @@ -118,7 +118,7 @@ @Override public void init() throws ComponentInitException { try { - if(kb == null) + if(url != null) kb = KBParser.parseKBFile(url); } catch (IOException e) { throw new ComponentInitException("KB file " + url + " could not be read.", e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-19 18:28:34
|
Revision: 615 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=615&view=rev Author: jenslehmann Date: 2008-02-19 10:28:23 -0800 (Tue, 19 Feb 2008) Log Message: ----------- extended KBparser to be able to read object/datatype property domain/range Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/KB.java trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/parser/KBParser.java trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/kb.jj trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java Modified: trunk/src/dl-learner/org/dllearner/core/owl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-02-19 16:44:57 UTC (rev 614) +++ trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-02-19 18:28:23 UTC (rev 615) @@ -165,6 +165,19 @@ rbox.add(axiom); } + /** + * Add another knowledge base to this one. + * @param kb The knowledge base to add. + */ + public void addKB(KB kb) { + for(AssertionalAxiom axiom : kb.getAbox()) + abox.add(axiom); + for(PropertyAxiom axiom : kb.getRbox()) + rbox.add(axiom); + for(TerminologicalAxiom axiom : kb.getTbox()) + tbox.add(axiom); + } + public int getLength() { int length = 0; for(Axiom a : abox) Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-19 16:44:57 UTC (rev 614) +++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-19 18:28:23 UTC (rev 615) @@ -42,6 +42,7 @@ import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectPropertyAssertion; import org.dllearner.core.owl.SubClassAxiom; +import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; import org.dllearner.parser.PrologParser; import org.dllearner.prolog.Atom; @@ -139,7 +140,9 @@ kb.addAxiom(sc); } // define properties including domain and range - // ... TODO ... + String kbString = "DPDOMAIN(" + getURI2("charge") + ") = " + getURI2("Atom") + "."; + KB kb2 = KBParser.parseKBFile(kbString); + kb.addKB(kb2); // mapping clauses to axioms System.out.print("Mapping clauses to axioms ... "); @@ -332,6 +335,15 @@ return new NamedClass(ontologyURI + "#" + name); } + private static String getURI(String name) { + return ontologyURI + "#" + name; + } + + // returns URI including quotationsmark (need for KBparser) + private static String getURI2(String name) { + return "\"" + getURI(name) + "\""; + } + private static String getFullElementName(String abbreviation) { // return corresponding element or throw an error if it // is not in the list Modified: trunk/src/dl-learner/org/dllearner/parser/KBParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-19 16:44:57 UTC (rev 614) +++ trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-19 18:28:23 UTC (rev 615) @@ -63,6 +63,11 @@ case 30: case 31: case 32: + case 34: + case 35: + case 36: + case 37: + case 38: ; break; default: @@ -97,6 +102,17 @@ rBoxAxiom = Subrole(); kb.addRBoxAxiom(rBoxAxiom); break; + case 34: + case 35: + case 36: + rBoxAxiom = ObjectPropertyDomainAxiom(); + kb.addRBoxAxiom(rBoxAxiom); + break; + case 37: + case 38: + rBoxAxiom = DatatypePropertyDomainAxiom(); + kb.addRBoxAxiom(rBoxAxiom); + break; default: jj_la1[1] = jj_gen; if (jj_2_3(2147483647)) { @@ -248,6 +264,125 @@ throw new Error("Missing return statement in function"); } + final public ObjectPropertyDomainAxiom ObjectPropertyDomainAxiom() throws ParseException { + ObjectProperty op; Description domain; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 34: + jj_consume_token(34); + break; + case 35: + jj_consume_token(35); + break; + case 36: + jj_consume_token(36); + break; + default: + jj_la1[4] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(22); + op = ObjectProperty(); + jj_consume_token(23); + jj_consume_token(25); + domain = Concept(); + jj_consume_token(COMMAND_END); + {if (true) return new ObjectPropertyDomainAxiom(op, domain);} + throw new Error("Missing return statement in function"); + } + + final public DatatypePropertyDomainAxiom DatatypePropertyDomainAxiom() throws ParseException { + DatatypeProperty op; Description domain; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 37: + jj_consume_token(37); + break; + case 38: + jj_consume_token(38); + break; + default: + jj_la1[5] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(22); + op = DatatypeProperty(); + jj_consume_token(23); + jj_consume_token(25); + domain = Concept(); + jj_consume_token(COMMAND_END); + {if (true) return new DatatypePropertyDomainAxiom(op, domain);} + throw new Error("Missing return statement in function"); + } + + final public ObjectPropertyRangeAxiom ObjectPropertyRangeAxiom() throws ParseException { + ObjectProperty op; Description range; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 39: + jj_consume_token(39); + break; + case 40: + jj_consume_token(40); + break; + case 41: + jj_consume_token(41); + break; + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(22); + op = ObjectProperty(); + jj_consume_token(23); + jj_consume_token(25); + range = Concept(); + jj_consume_token(COMMAND_END); + {if (true) return new ObjectPropertyRangeAxiom(op, range);} + throw new Error("Missing return statement in function"); + } + + final public DatatypePropertyRangeAxiom DatatypePropertyRangeAxiom() throws ParseException { + DatatypeProperty op; DataRange range; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 42: + jj_consume_token(42); + break; + case 43: + jj_consume_token(43); + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(22); + op = DatatypeProperty(); + jj_consume_token(23); + jj_consume_token(25); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 44: + jj_consume_token(44); + range = new Datatype(Datatype.Type.DOUBLE); + break; + case 45: + jj_consume_token(45); + range = new Datatype(Datatype.Type.BOOLEAN); + break; + case 46: + jj_consume_token(46); + range = new Datatype(Datatype.Type.INT); + break; + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(COMMAND_END); + {if (true) return new DatatypePropertyRangeAxiom(op, range);} + throw new Error("Missing return statement in function"); + } + final public Description Concept() throws ParseException { Description c,c1,c2; NamedClass ac; @@ -269,7 +404,7 @@ {if (true) return ac;} break; default: - jj_la1[4] = jj_gen; + jj_la1[9] = jj_gen; if (jj_2_5(2147483647)) { jj_consume_token(22); c1 = Concept(); @@ -322,7 +457,7 @@ {if (true) return new ObjectMaxCardinalityRestriction(i,ar,c);} break; default: - jj_la1[5] = jj_gen; + jj_la1[10] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -377,7 +512,7 @@ name = String(); break; default: - jj_la1[6] = jj_gen; + jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -385,6 +520,24 @@ throw new Error("Missing return statement in function"); } + final public DatatypeProperty DatatypeProperty() throws ParseException { + String name; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + name = Id(); + break; + case STRING: + name = String(); + break; + default: + jj_la1[12] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return new DatatypeProperty(getInternalURI(name));} + throw new Error("Missing return statement in function"); + } + final public ObjectProperty ObjectProperty() throws ParseException { String name; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -395,7 +548,7 @@ name = String(); break; default: - jj_la1[7] = jj_gen; + jj_la1[13] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -413,7 +566,7 @@ name = String(); break; default: - jj_la1[8] = jj_gen; + jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -499,6 +652,53 @@ finally { jj_save(5, xla); } } + final private boolean jj_3_1() { + if (jj_3R_2()) return true; + if (jj_scan_token(22)) return true; + if (jj_3R_3()) return true; + if (jj_scan_token(23)) return true; + if (jj_scan_token(COMMAND_END)) return true; + return false; + } + + final private boolean jj_3R_22() { + if (jj_scan_token(STRING)) return true; + return false; + } + + final private boolean jj_3R_14() { + if (jj_scan_token(20)) return true; + if (jj_3R_20()) return true; + if (jj_3R_4()) return true; + if (jj_scan_token(COMMAND_END)) return true; + if (jj_3R_2()) return true; + return false; + } + + final private boolean jj_3R_17() { + if (jj_3R_21()) return true; + return false; + } + + final private boolean jj_3R_4() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_17()) { + jj_scanpos = xsp; + if (jj_3R_18()) return true; + } + return false; + } + + final private boolean jj_3R_13() { + if (jj_scan_token(19)) return true; + if (jj_3R_20()) return true; + if (jj_3R_4()) return true; + if (jj_scan_token(COMMAND_END)) return true; + if (jj_3R_2()) return true; + return false; + } + final private boolean jj_3_6() { if (jj_scan_token(22)) return true; if (jj_3R_2()) return true; @@ -512,12 +712,8 @@ return false; } - final private boolean jj_3_1() { - if (jj_3R_2()) return true; - if (jj_scan_token(22)) return true; - if (jj_3R_3()) return true; - if (jj_scan_token(23)) return true; - if (jj_scan_token(COMMAND_END)) return true; + final private boolean jj_3R_20() { + if (jj_scan_token(NUMBER)) return true; return false; } @@ -541,21 +737,6 @@ return false; } - final private boolean jj_3R_17() { - if (jj_3R_21()) return true; - return false; - } - - final private boolean jj_3R_4() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_17()) { - jj_scanpos = xsp; - if (jj_3R_18()) return true; - } - return false; - } - final private boolean jj_3R_10() { if (jj_scan_token(16)) return true; if (jj_3R_4()) return true; @@ -573,8 +754,14 @@ return false; } - final private boolean jj_3R_20() { - if (jj_scan_token(NUMBER)) return true; + final private boolean jj_3_4() { + if (jj_3R_2()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(26)) { + jj_scanpos = xsp; + if (jj_scan_token(27)) return true; + } return false; } @@ -587,6 +774,12 @@ return false; } + final private boolean jj_3_3() { + if (jj_3R_2()) return true; + if (jj_scan_token(25)) return true; + return false; + } + final private boolean jj_3R_23() { if (jj_3R_21()) return true; return false; @@ -602,6 +795,11 @@ return false; } + final private boolean jj_3R_16() { + if (jj_3R_22()) return true; + return false; + } + final private boolean jj_3R_7() { if (jj_3R_19()) return true; return false; @@ -651,28 +849,6 @@ return false; } - final private boolean jj_3R_16() { - if (jj_3R_22()) return true; - return false; - } - - final private boolean jj_3_4() { - if (jj_3R_2()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(26)) { - jj_scanpos = xsp; - if (jj_scan_token(27)) return true; - } - return false; - } - - final private boolean jj_3_3() { - if (jj_3R_2()) return true; - if (jj_scan_token(25)) return true; - return false; - } - final private boolean jj_3R_21() { if (jj_scan_token(ID)) return true; return false; @@ -683,15 +859,6 @@ return false; } - final private boolean jj_3R_14() { - if (jj_scan_token(20)) return true; - if (jj_3R_20()) return true; - if (jj_3R_4()) return true; - if (jj_scan_token(COMMAND_END)) return true; - if (jj_3R_2()) return true; - return false; - } - final private boolean jj_3R_15() { if (jj_3R_21()) return true; return false; @@ -707,20 +874,6 @@ return false; } - final private boolean jj_3R_13() { - if (jj_scan_token(19)) return true; - if (jj_3R_20()) return true; - if (jj_3R_4()) return true; - if (jj_scan_token(COMMAND_END)) return true; - if (jj_3R_2()) return true; - return false; - } - - final private boolean jj_3R_22() { - if (jj_scan_token(STRING)) return true; - return false; - } - final private boolean jj_3_2() { Token xsp; xsp = jj_scanpos; @@ -741,7 +894,7 @@ public boolean lookingAhead = false; private boolean jj_semLA; private int jj_gen; - final private int[] jj_la1 = new int[9]; + final private int[] jj_la1 = new int[15]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { @@ -749,10 +902,10 @@ jj_la1_1(); } private static void jj_la1_0() { - jj_la1_0 = new int[] {0xf07f3200,0xf0000000,0x40000,0xc000000,0x203200,0x1f0000,0x200200,0x200200,0x200200,}; + jj_la1_0 = new int[] {0xf07f3200,0xf0000000,0x40000,0xc000000,0x0,0x0,0x0,0x0,0x0,0x203200,0x1f0000,0x200200,0x200200,0x200200,0x200200,}; } private static void jj_la1_1() { - jj_la1_1 = new int[] {0x1,0x1,0x0,0x2,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_1 = new int[] {0x7d,0x7d,0x0,0x2,0x1c,0x60,0x380,0xc00,0x7000,0x0,0x0,0x0,0x0,0x0,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[6]; private boolean jj_rescan = false; @@ -767,7 +920,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 9; i++) jj_la1[i] = -1; + for (int i = 0; i < 15; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -780,7 +933,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 9; i++) jj_la1[i] = -1; + for (int i = 0; i < 15; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -790,7 +943,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 9; i++) jj_la1[i] = -1; + for (int i = 0; i < 15; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -800,7 +953,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 9; i++) jj_la1[i] = -1; + for (int i = 0; i < 15; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -809,7 +962,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 9; i++) jj_la1[i] = -1; + for (int i = 0; i < 15; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -818,7 +971,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 9; i++) jj_la1[i] = -1; + for (int i = 0; i < 15; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -929,12 +1082,12 @@ public ParseException generateParseException() { jj_expentries.removeAllElements(); - boolean[] la1tokens = new boolean[34]; + boolean[] la1tokens = new boolean[47]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 9; i++) { + for (int i = 0; i < 15; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { @@ -946,7 +1099,7 @@ } } } - for (int i = 0; i < 34; i++) { + for (int i = 0; i < 47; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2008-02-19 16:44:57 UTC (rev 614) +++ trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2008-02-19 18:28:23 UTC (rev 615) @@ -59,6 +59,19 @@ "\"Inverse\"", "\"Subrole\"", "\"SUBCONCEPTOF\"", + "\"DOMAIN\"", + "\"OPDOMAIN\"", + "\"OBJECTPROPERTYDOMAIN\"", + "\"DPDOMAIN\"", + "\"DATATYPEPROPERTYDOMAIN\"", + "\"RANGE\"", + "\"OPRANGE\"", + "\"OBJECTPROPERTYRANGE\"", + "\"DPRANGE\"", + "\"DATATYPEPROPERTYRANGE\"", + "\"DOUBLE\"", + "\"BOOLEAN\"", + "\"INTEGER\"", }; } Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2008-02-19 16:44:57 UTC (rev 614) +++ trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2008-02-19 18:28:23 UTC (rev 615) @@ -63,13 +63,17 @@ case 65: return jjMoveStringLiteralDfa1_0(0x4000L); case 66: - return jjMoveStringLiteralDfa1_0(0x2000L); + return jjMoveStringLiteralDfa1_0(0x200000002000L); + case 68: + return jjMoveStringLiteralDfa1_0(0x1c6400000000L); case 70: return jjMoveStringLiteralDfa1_0(0x20000000L); case 73: - return jjMoveStringLiteralDfa1_0(0x80000000L); + return jjMoveStringLiteralDfa1_0(0x400080000000L); case 79: - return jjMoveStringLiteralDfa1_0(0x8000L); + return jjMoveStringLiteralDfa1_0(0x31800008000L); + case 82: + return jjMoveStringLiteralDfa1_0(0x8000000000L); case 83: return jjMoveStringLiteralDfa1_0(0x34c000000L); case 84: @@ -93,10 +97,16 @@ else if ((active0 & 0x100000L) != 0L) return jjStopAtPos(1, 20); break; + case 65: + return jjMoveStringLiteralDfa2_0(active0, 0x8c000000000L); + case 66: + return jjMoveStringLiteralDfa2_0(active0, 0x21000000000L); case 78: - return jjMoveStringLiteralDfa2_0(active0, 0x4000L); + return jjMoveStringLiteralDfa2_0(active0, 0x400000004000L); case 79: - return jjMoveStringLiteralDfa2_0(active0, 0x3000L); + return jjMoveStringLiteralDfa2_0(active0, 0x300400003000L); + case 80: + return jjMoveStringLiteralDfa2_0(active0, 0x52800000000L); case 82: if ((active0 & 0x8000L) != 0L) return jjStopAtPos(1, 15); @@ -137,13 +147,25 @@ case 68: if ((active0 & 0x4000L) != 0L) return jjStopAtPos(2, 14); - break; + return jjMoveStringLiteralDfa3_0(active0, 0x2800000000L); + case 74: + return jjMoveStringLiteralDfa3_0(active0, 0x21000000000L); + case 77: + return jjMoveStringLiteralDfa3_0(active0, 0x400000000L); + case 78: + return jjMoveStringLiteralDfa3_0(active0, 0x8000000000L); + case 79: + return jjMoveStringLiteralDfa3_0(active0, 0x200000000000L); case 80: if ((active0 & 0x1000L) != 0L) return jjStopAtPos(2, 12); break; + case 82: + return jjMoveStringLiteralDfa3_0(active0, 0x50000000000L); case 84: - return jjMoveStringLiteralDfa3_0(active0, 0x2000L); + return jjMoveStringLiteralDfa3_0(active0, 0x484000002000L); + case 85: + return jjMoveStringLiteralDfa3_0(active0, 0x100000000000L); case 97: return jjMoveStringLiteralDfa3_0(active0, 0x10000000L); case 98: @@ -170,8 +192,20 @@ } switch(curChar) { + case 65: + return jjMoveStringLiteralDfa4_0(active0, 0xd4400000000L); + case 66: + return jjMoveStringLiteralDfa4_0(active0, 0x100000000000L); case 67: return jjMoveStringLiteralDfa4_0(active0, 0x204000000L); + case 69: + return jjMoveStringLiteralDfa4_0(active0, 0x421000000000L); + case 71: + return jjMoveStringLiteralDfa4_0(active0, 0x8000000000L); + case 76: + return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L); + case 79: + return jjMoveStringLiteralDfa4_0(active0, 0x2800000000L); case 84: return jjMoveStringLiteralDfa4_0(active0, 0x2000L); case 99: @@ -200,10 +234,26 @@ } switch(curChar) { + case 67: + return jjMoveStringLiteralDfa5_0(active0, 0x21000000000L); + case 69: + if ((active0 & 0x8000000000L) != 0L) + return jjStopAtPos(4, 39); + return jjMoveStringLiteralDfa5_0(active0, 0x200000000000L); + case 71: + return jjMoveStringLiteralDfa5_0(active0, 0x400000000000L); + case 73: + return jjMoveStringLiteralDfa5_0(active0, 0x400000000L); case 76: - return jjMoveStringLiteralDfa5_0(active0, 0x4000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x100004000000L); + case 77: + return jjMoveStringLiteralDfa5_0(active0, 0x2800000000L); + case 78: + return jjMoveStringLiteralDfa5_0(active0, 0x50000000000L); case 79: return jjMoveStringLiteralDfa5_0(active0, 0x200002000L); + case 84: + return jjMoveStringLiteralDfa5_0(active0, 0x84000000000L); case 101: return jjMoveStringLiteralDfa5_0(active0, 0x40000000L); case 111: @@ -231,13 +281,25 @@ switch(curChar) { case 65: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000L); + return jjMoveStringLiteralDfa6_0(active0, 0x202804000000L); + case 69: + if ((active0 & 0x100000000000L) != 0L) + return jjStopAtPos(5, 44); + return jjMoveStringLiteralDfa6_0(active0, 0x400000000000L); + case 71: + return jjMoveStringLiteralDfa6_0(active0, 0x50000000000L); case 77: if ((active0 & 0x2000L) != 0L) return jjStopAtPos(5, 13); break; case 78: + if ((active0 & 0x400000000L) != 0L) + return jjStopAtPos(5, 34); return jjMoveStringLiteralDfa6_0(active0, 0x200000000L); + case 84: + return jjMoveStringLiteralDfa6_0(active0, 0x21000000000L); + case 89: + return jjMoveStringLiteralDfa6_0(active0, 0x84000000000L); case 105: return jjMoveStringLiteralDfa6_0(active0, 0x30000000L); case 108: @@ -264,6 +326,24 @@ { case 67: return jjMoveStringLiteralDfa7_0(active0, 0x200000000L); + case 69: + if ((active0 & 0x10000000000L) != 0L) + return jjStopAtPos(6, 40); + else if ((active0 & 0x40000000000L) != 0L) + return jjStopAtPos(6, 42); + break; + case 73: + return jjMoveStringLiteralDfa7_0(active0, 0x2800000000L); + case 78: + if ((active0 & 0x200000000000L) != 0L) + return jjStopAtPos(6, 45); + break; + case 80: + return jjMoveStringLiteralDfa7_0(active0, 0xa5000000000L); + case 82: + if ((active0 & 0x400000000000L) != 0L) + return jjStopAtPos(6, 46); + break; case 83: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L); case 101: @@ -295,7 +375,15 @@ switch(curChar) { case 69: - return jjMoveStringLiteralDfa8_0(active0, 0x200000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x84200000000L); + case 78: + if ((active0 & 0x800000000L) != 0L) + return jjStopAtPos(7, 35); + else if ((active0 & 0x2000000000L) != 0L) + return jjStopAtPos(7, 37); + break; + case 82: + return jjMoveStringLiteralDfa8_0(active0, 0x21000000000L); case 83: return jjMoveStringLiteralDfa8_0(active0, 0x4000000L); case 105: @@ -319,9 +407,9 @@ switch(curChar) { case 79: - return jjMoveStringLiteralDfa9_0(active0, 0x4000000L); + return jjMoveStringLiteralDfa9_0(active0, 0x21004000000L); case 80: - return jjMoveStringLiteralDfa9_0(active0, 0x200000000L); + return jjMoveStringLiteralDfa9_0(active0, 0x84200000000L); case 97: return jjMoveStringLiteralDfa9_0(active0, 0x20000000L); case 99: @@ -350,6 +438,10 @@ if ((active0 & 0x4000000L) != 0L) return jjStopAtPos(9, 26); break; + case 80: + return jjMoveStringLiteralDfa10_0(active0, 0x21000000000L); + case 82: + return jjMoveStringLiteralDfa10_0(active0, 0x84000000000L); case 84: return jjMoveStringLiteralDfa10_0(active0, 0x200000000L); case 101: @@ -376,8 +468,10 @@ } switch(curChar) { + case 69: + return jjMoveStringLiteralDfa11_0(active0, 0x21000000000L); case 79: - return jjMoveStringLiteralDfa11_0(active0, 0x200000000L); + return jjMoveStringLiteralDfa11_0(active0, 0x84200000000L); default : break; } @@ -398,11 +492,237 @@ if ((active0 & 0x200000000L) != 0L) return jjStopAtPos(11, 33); break; + case 80: + return jjMoveStringLiteralDfa12_0(active0, 0x84000000000L); + case 82: + return jjMoveStringLiteralDfa12_0(active0, 0x21000000000L); default : break; } return jjStartNfa_0(10, active0); } +private final int jjMoveStringLiteralDfa12_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(10, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(11, active0); + return 12; + } + switch(curChar) + { + case 69: + return jjMoveStringLiteralDfa13_0(active0, 0x84000000000L); + case 84: + return jjMoveStringLiteralDfa13_0(active0, 0x21000000000L); + default : + break; + } + return jjStartNfa_0(11, active0); +} +private final int jjMoveStringLiteralDfa13_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(11, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(12, active0); + return 13; + } + switch(curChar) + { + case 82: + return jjMoveStringLiteralDfa14_0(active0, 0x84000000000L); + case 89: + return jjMoveStringLiteralDfa14_0(active0, 0x21000000000L); + default : + break; + } + return jjStartNfa_0(12, active0); +} +private final int jjMoveStringLiteralDfa14_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(12, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(13, active0); + return 14; + } + switch(curChar) + { + case 68: + return jjMoveStringLiteralDfa15_0(active0, 0x1000000000L); + case 82: + return jjMoveStringLiteralDfa15_0(active0, 0x20000000000L); + case 84: + return jjMoveStringLiteralDfa15_0(active0, 0x84000000000L); + default : + break; + } + return jjStartNfa_0(13, active0); +} +private final int jjMoveStringLiteralDfa15_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(13, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(14, active0); + return 15; + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa16_0(active0, 0x20000000000L); + case 79: + return jjMoveStringLiteralDfa16_0(active0, 0x1000000000L); + case 89: + return jjMoveStringLiteralDfa16_0(active0, 0x84000000000L); + default : + break; + } + return jjStartNfa_0(14, active0); +} +private final int jjMoveStringLiteralDfa16_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(14, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(15, active0); + return 16; + } + switch(curChar) + { + case 68: + return jjMoveStringLiteralDfa17_0(active0, 0x4000000000L); + case 77: + return jjMoveStringLiteralDfa17_0(active0, 0x1000000000L); + case 78: + return jjMoveStringLiteralDfa17_0(active0, 0x20000000000L); + case 82: + return jjMoveStringLiteralDfa17_0(active0, 0x80000000000L); + default : + break; + } + return jjStartNfa_0(15, active0); +} +private final int jjMoveStringLiteralDfa17_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(15, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(16, active0); + return 17; + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa18_0(active0, 0x81000000000L); + case 71: + return jjMoveStringLiteralDfa18_0(active0, 0x20000000000L); + case 79: + return jjMoveStringLiteralDfa18_0(active0, 0x4000000000L); + default : + break; + } + return jjStartNfa_0(16, active0); +} +private final int jjMoveStringLiteralDfa18_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(16, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(17, active0); + return 18; + } + switch(curChar) + { + case 69: + if ((active0 & 0x20000000000L) != 0L) + return jjStopAtPos(18, 41); + break; + case 73: + return jjMoveStringLiteralDfa19_0(active0, 0x1000000000L); + case 77: + return jjMoveStringLiteralDfa19_0(active0, 0x4000000000L); + case 78: + return jjMoveStringLiteralDfa19_0(active0, 0x80000000000L); + default : + break; + } + return jjStartNfa_0(17, active0); +} +private final int jjMoveStringLiteralDfa19_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(17, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(18, active0); + return 19; + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa20_0(active0, 0x4000000000L); + case 71: + return jjMoveStringLiteralDfa20_0(active0, 0x80000000000L); + case 78: + if ((active0 & 0x1000000000L) != 0L) + return jjStopAtPos(19, 36); + break; + default : + break; + } + return jjStartNfa_0(18, active0); +} +private final int jjMoveStringLiteralDfa20_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(18, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(19, active0); + return 20; + } + switch(curChar) + { + case 69: + if ((active0 & 0x80000000000L) != 0L) + return jjStopAtPos(20, 43); + break; + case 73: + return jjMoveStringLiteralDfa21_0(active0, 0x4000000000L); + default : + break; + } + return jjStartNfa_0(19, active0); +} +private final int jjMoveStringLiteralDfa21_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(19, old0); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(20, active0); + return 21; + } + switch(curChar) + { + case 78: + if ((active0 & 0x4000000000L) != 0L) + return jjStopAtPos(21, 38); + break; + default : + break; + } + return jjStartNfa_0(20, active0); +} private final void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) @@ -818,12 +1138,18 @@ "\76\75", "\74\75", null, "\50", "\51", "\54", "\75", "\123\125\102\103\114\101\123\123\117\106", "\123\125\102", "\124\162\141\156\163\151\164\151\166\145", "\106\165\156\143\164\151\157\156\141\154", "\123\171\155\155\145\164\162\151\143", "\111\156\166\145\162\163\145", -"\123\165\142\162\157\154\145", "\123\125\102\103\117\116\103\105\120\124\117\106", }; +"\123\165\142\162\157\154\145", "\123\125\102\103\117\116\103\105\120\124\117\106", +"\104\117\115\101\111\116", "\117\120\104\117\115\101\111\116", +"\117\102\112\105\103\124\120\122\117\120\105\122\124\131\104\117\115\101\111\116", "\104\120\104\117\115\101\111\116", +"\104\101\124\101\124\131\120\105\120\122\117\120\105\122\124\131\104\117\115\101\111\116", "\122\101\116\107\105", "\117\120\122\101\116\107\105", +"\117\102\112\105\103\124\120\122\117\120\105\122\124\131\122\101\116\107\105", "\104\120\122\101\116\107\105", +"\104\101\124\101\124\131\120\105\120\122\117\120\105\122\124\131\122\101\116\107\105", "\104\117\125\102\114\105", "\102\117\117\114\105\101\116", +"\111\116\124\105\107\105\122", }; public static final String[] lexStateNames = { "DEFAULT", }; static final long[] jjtoToken = { - 0x3ffffff01L, + 0x7fffffffff01L, }; static final long[] jjtoSkip = { 0xfeL, Modified: trunk/src/dl-learner/org/dllearner/parser/kb.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-19 16:44:57 UTC (rev 614) +++ trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-19 18:28:23 UTC (rev 615) @@ -123,6 +123,10 @@ { kb.addRBoxAxiom(rBoxAxiom); } | rBoxAxiom = Subrole() { kb.addRBoxAxiom(rBoxAxiom); } + | rBoxAxiom = ObjectPropertyDomainAxiom() + { kb.addRBoxAxiom(rBoxAxiom); } + | rBoxAxiom = DatatypePropertyDomainAxiom() + { kb.addRBoxAxiom(rBoxAxiom); } // da Konfigurationsoptionen ausgeschlossen sind, reicht es bis zum "=" zu suchen | LOOKAHEAD(Concept() "=") equality = TBoxEquiv() { kb.addTBoxAxiom(equality); } @@ -198,6 +202,34 @@ { return new SubClassAxiom(c1,c2);} } +ObjectPropertyDomainAxiom ObjectPropertyDomainAxiom() : {ObjectProperty op; Description domain; } +{ + ("DOMAIN" | "OPDOMAIN" | "OBJECTPROPERTYDOMAIN") "(" op=ObjectProperty() ")" "=" domain=Concept() <COMMAND_END> + { return new ObjectPropertyDomainAxiom(op, domain); } +} + +DatatypePropertyDomainAxiom DatatypePropertyDomainAxiom() : {DatatypeProperty op; Description domain; } +{ + ( "DPDOMAIN" | "DATATYPEPROPERTYDOMAIN" ) "(" op=DatatypeProperty() ")" "=" domain=Concept() <COMMAND_END> + { return new DatatypePropertyDomainAxiom(op, domain); } +} + +ObjectPropertyRangeAxiom ObjectPropertyRangeAxiom() : {ObjectProperty op; Description range; } +{ + ("RANGE" | "OPRANGE" | "OBJECTPROPERTYRANGE") "(" op=ObjectProperty() ")" "=" range=Concept() <COMMAND_END> + { return new ObjectPropertyRangeAxiom(op, range); } +} + +DatatypePropertyRangeAxiom DatatypePropertyRangeAxiom() : {DatatypeProperty op; DataRange range; } +{ + ( "DPRANGE" | "DATATYPEPROPERTYRANGE") "(" op=DatatypeProperty() ")" "=" + ( "DOUBLE" { range = new Datatype(Datatype.Type.DOUBLE); } + | "BOOLEAN" { range = new Datatype(Datatype.Type.BOOLEAN); } + | "INTEGER" { range = new Datatype(Datatype.Type.INT); } ) + <COMMAND_END> + { return new DatatypePropertyRangeAxiom(op, range); } +} + Description Concept() : { Description c,c1,c2; @@ -259,6 +291,17 @@ } } +DatatypeProperty DatatypeProperty() : +{ + String name; +} +{ + (name=Id() | name=String()) + { + return new DatatypeProperty(getInternalURI(name)); + } +} + ObjectProperty ObjectProperty() : { String name; Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-19 16:44:57 UTC (rev 614) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-19 18:28:23 UTC (rev 615) @@ -240,8 +240,10 @@ * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.DatatypePropertyDomainAxiom) */ public void visit(DatatypePropertyDomainAxiom datatypePropertyDomainAxiom) { - // TODO Auto-generated method stub - + OWLDescription d = getOWLDescription(datatypePropertyDomainAxiom.getDomain()); + OWLDataProperty dp = factory.getOWLDataProperty(URI.create(datatypePropertyDomainAxiom.getProperty().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLDataPropertyDomainAxiom(dp, d); + addAxiom(axiomOWLAPI); } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-21 16:25:57
|
Revision: 620 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=620&view=rev Author: jenslehmann Date: 2008-02-21 08:25:48 -0800 (Thu, 21 Feb 2008) Log Message: ----------- instance check code preparation Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/FlatABox.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java Modified: trunk/src/dl-learner/org/dllearner/core/owl/FlatABox.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/FlatABox.java 2008-02-21 16:21:05 UTC (rev 619) +++ trunk/src/dl-learner/org/dllearner/core/owl/FlatABox.java 2008-02-21 16:25:48 UTC (rev 620) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.owl; import java.util.HashMap; @@ -6,28 +25,18 @@ import java.util.TreeSet; /** - * TODO: Später mal eine Singleton-Klasse daraus machen und get-und set-Methoden - * für alle Klassenvariablen. - * TODO: Diese Klasse soll später mal alles geparstes DL-Wissen enthalten. Es muss - * also irgendwie die "geparste ABox" (für eigenen Algorithmus) und das unveränderte - * Wissen enthalten (für KAON2). Eventuell ist auch eine Trennung in 2 Klassen möglich. + * A flat ABox can be used to store knowledge of a completely dematerialised knowledge base. * - * TODO: Singleton wieder rueckgaengig machen, da FlatABox nur noch - * Mittel zum Zweck fuer die neue abstrakte Reasoner-Klasse ist - * * @author Jens Lehmann * */ public class FlatABox { - - // singleton-instance - // private static FlatABox singleton = new FlatABox(); public SortedSet<String> roles = new TreeSet<String>(); public SortedSet<String> concepts = new TreeSet<String>(); public SortedSet<String> domain = new TreeSet<String>(); public SortedSet<String> top = new TreeSet<String>(); - public SortedSet<String> bottom = new TreeSet<String>(); + public SortedSet<String> bottom = new TreeSet<String>(); public Map<String,SortedSet<String>> atomicConceptsPos = new HashMap<String,SortedSet<String>>(); public Map<String,SortedSet<String>> atomicConceptsNeg = new HashMap<String,SortedSet<String>>(); @@ -37,29 +46,10 @@ public Map<String,SortedSet<String>> exampleConceptsPos = new HashMap<String,SortedSet<String>>(); public Map<String,SortedSet<String>> exampleConceptsNeg = new HashMap<String,SortedSet<String>>(); - // f�r bessere GP-Initialisierungs-Performance - private Object[] roleArray; - private Object[] conceptArray; - public FlatABox() { } - /* - public static FlatABox getInstance() { - return singleton; - } - */ - - // ABox vorbereiten f�r Algorithmus, hier wird nur eine Listenansicht auf - // Konzepte und Rollen erstellt, damit diese bei der GP-Initialisierung - // verwendet werden kann (es ist ansonsten nicht m�glich auf ein zuf�lliges - // Konzept zuzugreifen) - public void prepare() { - roleArray = roles.toArray(); - conceptArray = concepts.toArray(); - } - public SortedSet<String> getPositiveInstances(String conceptName) { return atomicConceptsPos.get(conceptName); } @@ -68,14 +58,6 @@ return atomicConceptsPos.get(conceptName); } - public String getConcept(int nr) { - return (String) conceptArray[nr]; - } - - public String getRole(int nr) { - return (String) roleArray[nr]; - } - @Override public String toString() { String output = ""; @@ -95,42 +77,41 @@ return (String) exampleConceptsPos.keySet().toArray()[0]; } - /* - public void createExampleABox() { - domain = new TreeSet<String>(); - domain.add("stefan"); - domain.add("markus"); - - top = domain; - bottom = new TreeSet<String>(); - - atomicConceptsPos = new HashMap<String,Set<String>>(); - Set<String> male = new TreeSet<String>(); - male.add("stefan"); - male.add("markus"); - atomicConceptsPos.put("male",male); - - atomicConceptsNeg = new HashMap<String,Set<String>>(); - Set<String> maleNeg = new TreeSet<String>(); - atomicConceptsNeg.put("male",maleNeg); - - rolesPos = new HashMap<String,Map<String,Set<String>>>(); - Map<String,Set<String>> hasChild = new HashMap<String,Set<String>>(); - Set<String> childsStefan = new TreeSet<String>(); - childsStefan.add("markus"); - hasChild.put("stefan",childsStefan); - Set<String> childsMarkus = new TreeSet<String>(); - hasChild.put("markus", childsMarkus); - rolesPos.put("hasChild", hasChild); - - rolesNeg = new HashMap<String,Map<String,Set<String>>>(); - Map<String,Set<String>> hasChildNeg = new HashMap<String,Set<String>>(); - Set<String> childsStefanNeg = new TreeSet<String>(); - hasChildNeg.put("stefan",childsStefanNeg); - Set<String> childsMarkusNeg = new TreeSet<String>(); - hasChildNeg.put("markus", childsMarkusNeg); - rolesNeg.put("hasChild", hasChildNeg); - } - */ +// public void createExampleABox() { +// domain = new TreeSet<String>(); +// domain.add("stefan"); +// domain.add("markus"); +// +// top = domain; +// bottom = new TreeSet<String>(); +// +// atomicConceptsPos = new HashMap<String,Set<String>>(); +// Set<String> male = new TreeSet<String>(); +// male.add("stefan"); +// male.add("markus"); +// atomicConceptsPos.put("male",male); +// +// atomicConceptsNeg = new HashMap<String,Set<String>>(); +// Set<String> maleNeg = new TreeSet<String>(); +// atomicConceptsNeg.put("male",maleNeg); +// +// rolesPos = new HashMap<String,Map<String,Set<String>>>(); +// Map<String,Set<String>> hasChild = new HashMap<String,Set<String>>(); +// Set<String> childsStefan = new TreeSet<String>(); +// childsStefan.add("markus"); +// hasChild.put("stefan",childsStefan); +// Set<String> childsMarkus = new TreeSet<String>(); +// hasChild.put("markus", childsMarkus); +// rolesPos.put("hasChild", hasChild); +// +// rolesNeg = new HashMap<String,Map<String,Set<String>>>(); +// Map<String,Set<String>> hasChildNeg = new HashMap<String,Set<String>>(); +// Set<String> childsStefanNeg = new TreeSet<String>(); +// hasChildNeg.put("stefan",childsStefanNeg); +// Set<String> childsMarkusNeg = new TreeSet<String>(); +// hasChildNeg.put("markus", childsMarkusNeg); +// rolesNeg.put("hasChild", hasChildNeg); +// } + } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-02-21 16:21:05 UTC (rev 619) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-02-21 16:25:48 UTC (rev 620) @@ -19,23 +19,90 @@ */ package org.dllearner.reasoning; +import java.util.HashMap; +import java.util.Map; import java.util.Set; import java.util.SortedSet; import org.dllearner.core.ComponentInitException; +import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.ReasoningService; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.owl.FlatABox; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; /** + * Reasoner for fast instance checks. It works by completely dematerialising the knowledge + * base to speed up later reasoning requests. It + * * @author Jens Lehmann * */ public class FastInstanceChecker extends ReasonerComponent { + private Set<NamedClass> atomicConcepts; + private Set<ObjectProperty> atomicRoles; + private SortedSet<Individual> individuals; + + private ReasoningService rs; + private ReasonerComponent rc; + + // instances of classes + public Map<NamedClass,SortedSet<Individual>> classInstancesPos = new HashMap<NamedClass,SortedSet<Individual>>(); + public Map<NamedClass,SortedSet<Individual>> classInstancesNeg = new HashMap<NamedClass,SortedSet<Individual>>(); + + // object property mappings + public Map<ObjectProperty,Map<Individual,SortedSet<Individual>>> opPos = new HashMap<ObjectProperty,Map<Individual,SortedSet<Individual>>>(); + public Map<ObjectProperty,Map<Individual,SortedSet<Individual>>> opNeg = new HashMap<ObjectProperty,Map<Individual,SortedSet<Individual>>>(); + + // TODO: datatype properties + + public FastInstanceChecker(Set<KnowledgeSource> sources) { + rc = new OWLAPIReasoner(sources); + try { + rc.init(); + } catch (ComponentInitException e1) { + e1.printStackTrace(); + } + atomicConcepts = rc.getAtomicConcepts(); + atomicRoles = rc.getAtomicRoles(); + individuals = rc.getIndividuals(); + rs = new ReasoningService(rc); + + // TODO: some code taken from Helper.createFlatABox, but pasted here because additional things need to + // be done (maybe this can be merge again with the FastRetrievalReasoner later) + long dematStartTime = System.currentTimeMillis(); + + FlatABox aBox = new FlatABox(); + for (NamedClass atomicConcept : rs.getAtomicConcepts()) { + // aBox.atomicConceptsPos.put(atomicConcept.getName(), getStringSet(rs + // .retrieval(atomicConcept))); +// Negation negatedAtomicConcept = new Negation(atomicConcept); + // aBox.atomicConceptsNeg.put(atomicConcept.getName(), getStringSet(rs + // .retrieval(negatedAtomicConcept))); + aBox.concepts.add(atomicConcept.getName()); + } + + for (ObjectProperty atomicRole : rs.getAtomicRoles()) { + // aBox.rolesPos.put(atomicRole.getName(), getStringMap(rs.getRoleMembers(atomicRole))); + aBox.roles.add(atomicRole.getName()); + } + + // aBox.domain = getStringSet(rs.getIndividuals()); + // aBox.top = aBox.domain; + + // System.out.println(aBox); + + long dematDuration = System.currentTimeMillis() - dematStartTime; + System.out.println("OK (" + dematDuration + " ms)"); + + } + + /* (non-Javadoc) * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.config.ConfigEntry) */ @@ -58,24 +125,21 @@ * @see org.dllearner.core.Reasoner#getAtomicConcepts() */ public Set<NamedClass> getAtomicConcepts() { - // TODO Auto-generated method stub - return null; + return atomicConcepts; } /* (non-Javadoc) * @see org.dllearner.core.Reasoner#getAtomicRoles() */ public Set<ObjectProperty> getAtomicRoles() { - // TODO Auto-generated method stub - return null; + return atomicRoles; } /* (non-Javadoc) * @see org.dllearner.core.Reasoner#getIndividuals() */ public SortedSet<Individual> getIndividuals() { - // TODO Auto-generated method stub - return null; + return individuals; } /* (non-Javadoc) Modified: trunk/src/dl-learner/org/dllearner/utilities/Helper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-02-21 16:21:05 UTC (rev 619) +++ trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-02-21 16:25:48 UTC (rev 620) @@ -539,8 +539,6 @@ aBox.domain = getStringSet(rs.getIndividuals()); aBox.top = aBox.domain; - // ab hier keine �nderungen mehr an FlatABox - aBox.prepare(); // System.out.println(aBox); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ton...@us...> - 2008-02-22 00:38:34
|
Revision: 624 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=624&view=rev Author: tonytacker Date: 2008-02-21 16:38:27 -0800 (Thu, 21 Feb 2008) Log Message: ----------- new public method in startCLI - should be the best way for me - using this methods in configload.java and it works Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-21 21:21:21 UTC (rev 623) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-02-22 00:38:27 UTC (rev 624) @@ -167,62 +167,26 @@ // step 2: detect used reasoner ConfFileOption reasonerOption = parser.getConfOptionsByName("reasoner"); - Class<? extends ReasonerComponent> reasonerClass = null; - // default value - if (reasonerOption == null || reasonerOption.getStringValue().equals("dig")) - reasonerClass = DIGReasoner.class; - else if (reasonerOption.getStringValue().equals("owlAPI")) - reasonerClass = OWLAPIReasoner.class; - else if (reasonerOption.getStringValue().equals("fastRetrieval")) - reasonerClass = FastRetrievalReasoner.class; - else { - handleError("Unknown value " + reasonerOption.getStringValue() - + " for option \"reasoner\"."); - } - ReasonerComponent reasoner = cm.reasoner(reasonerClass, sources); + ReasonerComponent reasoner = cm.reasoner(getReasonerClass(reasonerOption), sources); configureComponent(cm, reasoner, componentPrefixMapping, parser); initComponent(cm, reasoner); rs = cm.reasoningService(reasoner); // step 3: detect learning problem ConfFileOption problemOption = parser.getConfOptionsByName("problem"); - Class<? extends LearningProblem> lpClass = null; - if (problemOption == null || problemOption.getStringValue().equals("posNegDefinition")) - lpClass = PosNegDefinitionLP.class; - else if (problemOption.getStringValue().equals("posNegInclusion")) - lpClass = PosNegInclusionLP.class; - else if (problemOption.getStringValue().equals("posOnlyDefinition")) - lpClass = PosOnlyDefinitionLP.class; - else - handleError("Unknown value " + problemOption.getValue() + " for option \"problem\"."); - - lp = cm.learningProblem(lpClass, rs); + lp = cm.learningProblem(getLearningProblemClass(problemOption), rs); SortedSet<String> posExamples = parser.getPositiveExamples(); SortedSet<String> negExamples = parser.getNegativeExamples(); cm.applyConfigEntry(lp, "positiveExamples", posExamples); - if (lpClass != PosOnlyDefinitionLP.class) + if (getLearningProblemClass(problemOption) != PosOnlyDefinitionLP.class) cm.applyConfigEntry(lp, "negativeExamples", negExamples); configureComponent(cm, lp, componentPrefixMapping, parser); initComponent(cm, lp); // step 4: detect learning algorithm ConfFileOption algorithmOption = parser.getConfOptionsByName("algorithm"); - Class<? extends LearningAlgorithm> laClass = null; - if (algorithmOption == null || algorithmOption.getStringValue().equals("refinement")) - laClass = ROLearner.class; - else if (algorithmOption.getStringValue().equals("refexamples")) - laClass = ExampleBasedROLComponent.class; - else if (algorithmOption.getStringValue().equals("gp")) - laClass = GP.class; - else if (algorithmOption.getStringValue().equals("bruteForce")) - laClass = BruteForceLearner.class; - else if (algorithmOption.getStringValue().equals("randomGuesser")) - laClass = RandomGuesser.class; - else - handleError("Unknown value in " + algorithmOption); - try { - la = cm.learningAlgorithm(laClass, lp, rs); + la = cm.learningAlgorithm(getLearningAlgorithm(algorithmOption), lp, rs); } catch (LearningProblemUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -368,7 +332,7 @@ } /** - * detects all imported files and their format + * detects all imported files and their format */ public static Map<URL, Class<? extends KnowledgeSource>> getImportedFiles(ConfParser parser, String baseDir) { @@ -770,4 +734,73 @@ return rs; } + // edit by Tilo Hielscher + + /** + * Set Reasoner class. Define here all possible reasoners. + * + * @param reasonerOption + * from config file + * @return reasonerClass reasoner class + */ + public static Class<? extends ReasonerComponent> getReasonerClass(ConfFileOption reasonerOption) { + Class<? extends ReasonerComponent> reasonerClass = null; + if (reasonerOption == null || reasonerOption.getStringValue().equals("dig")) + reasonerClass = DIGReasoner.class; + else if (reasonerOption.getStringValue().equals("owlAPI")) + reasonerClass = OWLAPIReasoner.class; + else if (reasonerOption.getStringValue().equals("fastRetrieval")) + reasonerClass = FastRetrievalReasoner.class; + else { + handleError("Unknown value " + reasonerOption.getStringValue() + + " for option \"reasoner\"."); + } + return reasonerClass; + } + + /** + * Set LearningProblem class. Define here all possible problems. + * + * @param problemOption + * from config file + * @return lpClass learning problem class + */ + public static Class<? extends LearningProblem> getLearningProblemClass(ConfFileOption problemOption) { + Class<? extends LearningProblem> lpClass = null; + if (problemOption == null || problemOption.getStringValue().equals("posNegDefinition")) + lpClass = PosNegDefinitionLP.class; + else if (problemOption.getStringValue().equals("posNegInclusion")) + lpClass = PosNegInclusionLP.class; + else if (problemOption.getStringValue().equals("posOnlyDefinition")) + lpClass = PosOnlyDefinitionLP.class; + else + handleError("Unknown value " + problemOption.getValue() + " for option \"problem\"."); + + return lpClass; + } + + /** + * Set LearningAlorithm class. Define here all possible learning algorithms. + * + * @param algorithmOption + * from config file + * @return laClass learning algorithm class + */ + public static Class<? extends LearningAlgorithm> getLearningAlgorithm(ConfFileOption algorithmOption) { + Class<? extends LearningAlgorithm> laClass = null; + if (algorithmOption == null || algorithmOption.getStringValue().equals("refinement")) + laClass = ROLearner.class; + else if (algorithmOption.getStringValue().equals("refexamples")) + laClass = ExampleBasedROLComponent.class; + else if (algorithmOption.getStringValue().equals("gp")) + laClass = GP.class; + else if (algorithmOption.getStringValue().equals("bruteForce")) + laClass = BruteForceLearner.class; + else if (algorithmOption.getStringValue().equals("randomGuesser")) + laClass = RandomGuesser.class; + else + handleError("Unknown value in " + algorithmOption); + + return laClass; + } } Modified: trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-02-21 21:21:21 UTC (rev 623) +++ trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-02-22 00:38:27 UTC (rev 624) @@ -20,40 +20,16 @@ * */ -import java.io.File; // import java.net.URL; -import java.net.URL; // import java.util.HashSet; -import java.util.Map; // import java.util.Set; -import java.util.SortedSet; // import java.util.List; -// import java.util.Map; -import org.dllearner.algorithms.BruteForceLearner; -import org.dllearner.algorithms.RandomGuesser; -import org.dllearner.algorithms.gp.GP; -import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; -import org.dllearner.algorithms.refinement.ROLearner; +import java.io.File; +import java.net.URL; +import java.util.Map; +import java.util.SortedSet; import org.dllearner.core.ComponentInitException; -import org.dllearner.core.KnowledgeSource; // import -import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.LearningProblem; +import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.ReasonerComponent; // org.dllearner.core.LearningProblem; -// import org.dllearner.core.ReasoningService; -// import org.dllearner.core.LearningAlgorithm; -// import org.dllearner.core.ReasonerComponent; -// import org.dllearner.core.config.ConfigEntry; -// import org.dllearner.core.config.InvalidConfigOptionValueException; -// import org.dllearner.core.config.StringConfigOption; -import org.dllearner.learningproblems.PosNegDefinitionLP; -import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.parser.ConfParser; -import org.dllearner.reasoning.DIGReasoner; -import org.dllearner.reasoning.FastRetrievalReasoner; -import org.dllearner.reasoning.OWLAPIReasoner; // import -// org.dllearner.kb.KBFile; -// import org.dllearner.kb.OWLFile; -// import org.dllearner.kb.sparql.SparqlKnowledgeSource; -import org.dllearner.core.Component; // import -// org.dllearner.cli.ConfFileOption; +import org.dllearner.core.Component; import org.dllearner.cli.ConfFileOption; import org.dllearner.cli.Start; @@ -131,20 +107,8 @@ // REASONER ConfFileOption reasonerOption = parser.getConfOptionsByName("reasoner"); - Class<? extends ReasonerComponent> reasonerClass = null; - // default value - if (reasonerOption == null || reasonerOption.getStringValue().equals("dig")) - reasonerClass = DIGReasoner.class; - else if (reasonerOption.getStringValue().equals("owlAPI")) - reasonerClass = OWLAPIReasoner.class; - else if (reasonerOption.getStringValue().equals("fastRetrieval")) - reasonerClass = FastRetrievalReasoner.class; - else { - Start.handleError("Unknown value " + reasonerOption.getStringValue() - + " for option \"reasoner\"."); - } - config.setReasoner(config.getComponentManager().reasoner(reasonerClass, - config.getKnowledgeSource())); + config.setReasoner(config.getComponentManager().reasoner( + Start.getReasonerClass(reasonerOption), config.getKnowledgeSource())); Start.configureComponent(config.getComponentManager(), config.getReasoner(), componentPrefixMapping, parser); if (config.getKnowledgeSource() != null && config.getReasoner() != null) { @@ -164,23 +128,13 @@ // LEARNING PROBLEM ConfFileOption problemOption = parser.getConfOptionsByName("problem"); - Class<? extends LearningProblem> lpClass = null; - if (problemOption == null || problemOption.getStringValue().equals("posNegDefinition")) - lpClass = PosNegDefinitionLP.class; - else if (problemOption.getStringValue().equals("posNegInclusion")) - lpClass = PosNegInclusionLP.class; - else if (problemOption.getStringValue().equals("posOnlyDefinition")) - lpClass = PosOnlyDefinitionLP.class; - else - Start.handleError("Unknown value " + problemOption.getValue() - + " for option \"problem\"."); - config.setLearningProblem(config.getComponentManager().learningProblem(lpClass, - config.getReasoningService())); + config.setLearningProblem(config.getComponentManager().learningProblem( + Start.getLearningProblemClass(problemOption), config.getReasoningService())); SortedSet<String> posExamples = parser.getPositiveExamples(); SortedSet<String> negExamples = parser.getNegativeExamples(); config.getComponentManager().applyConfigEntry(config.getLearningProblem(), "positiveExamples", posExamples); - if (lpClass != PosOnlyDefinitionLP.class) + if (Start.getLearningProblemClass(problemOption) != PosOnlyDefinitionLP.class) config.getComponentManager().applyConfigEntry(config.getLearningProblem(), "negativeExamples", negExamples); Start.configureComponent(config.getComponentManager(), config.getLearningProblem(), @@ -198,30 +152,17 @@ // LEARNING ALGORITHM ConfFileOption algorithmOption = parser.getConfOptionsByName("algorithm"); - Class<? extends LearningAlgorithm> laClass = null; - if (algorithmOption == null || algorithmOption.getStringValue().equals("refinement")) - laClass = ROLearner.class; - else if(algorithmOption.getStringValue().equals("refexamples")) - laClass = ExampleBasedROLComponent.class; - else if(algorithmOption.getStringValue().equals("gp")) - laClass = GP.class; - else if(algorithmOption.getStringValue().equals("bruteForce")) - laClass = BruteForceLearner.class; - else if(algorithmOption.getStringValue().equals("randomGuesser")) - laClass = RandomGuesser.class; - else - Start.handleError("Unknown value in " + algorithmOption); - if (config.getLearningProblem() != null && config.getReasoningService() != null) { try { config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( - laClass, config.getLearningProblem(), - config.getReasoningService())); + Start.getLearningAlgorithm(algorithmOption), + config.getLearningProblem(), config.getReasoningService())); } catch (LearningProblemUnsupportedException e) { e.printStackTrace(); } } - Start.configureComponent(config.getComponentManager(), config.getLearningAlgorithm(), componentPrefixMapping, parser); + Start.configureComponent(config.getComponentManager(), config.getLearningAlgorithm(), + componentPrefixMapping, parser); if (config.getLearningProblem() != null) { try { config.getLearningAlgorithm().init(); @@ -231,15 +172,9 @@ e.printStackTrace(); } } - + // update graphic startGUI.updateTabColors(); - - //System.out.println("reasoner: " + parser.getConfOptionsByName("reasoner")); - //System.out.println("confoptions: " + parser.getConfOptions()); - //System.out.println("posExamples: " + parser.getPositiveExamples()); - //System.out.println("confoptionbyname: " + parser.getConfOptionsByName()); - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-22 17:05:23
|
Revision: 628 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=628&view=rev Author: jenslehmann Date: 2008-02-22 09:05:19 -0800 (Fri, 22 Feb 2008) Log Message: ----------- improved object/datatype property domain/range support Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Property.java trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java trunk/src/dl-learner/org/dllearner/parser/kb.jj trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java Modified: trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2008-02-22 17:05:19 UTC (rev 628) @@ -19,6 +19,7 @@ */ package org.dllearner.core.owl; +import java.net.URI; import java.util.Map; /** @@ -34,6 +35,8 @@ private Type type; + private static final String xsd = "http://www.w3.org/2001/XMLSchema#"; + public Datatype(Type type) { this.type = type; } @@ -60,6 +63,15 @@ return null; } + public URI getURI() { + switch(type) { + case DOUBLE: return URI.create(xsd + "double"); + case INT: return URI.create(xsd + "int"); + case BOOLEAN: return URI.create(xsd + "Boolean"); + default: throw new Error("Unknown tpye " + type + "."); + } + } + /** * @return the type */ Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java 2008-02-22 17:05:19 UTC (rev 628) @@ -38,6 +38,11 @@ return range.getLength() + 2; } + @Override + public DataRange getRange() { + return (DataRange) range; + } + /* (non-Javadoc) * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) */ Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-02-22 17:05:19 UTC (rev 628) @@ -30,7 +30,7 @@ * @author Jens Lehmann * */ -public class ObjectProperty extends ObjectPropertyExpression implements Property, NamedKBElement, Comparable<ObjectProperty> { +public class ObjectProperty extends ObjectPropertyExpression implements Property, Comparable<ObjectProperty> { public ObjectProperty(String name) { super(name); Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java 2008-02-22 17:05:19 UTC (rev 628) @@ -28,12 +28,10 @@ public class ObjectPropertyRangeAxiom extends PropertyRangeAxiom { - public ObjectPropertyRangeAxiom(ObjectProperty property, Description domain) { - super(property, domain); + public ObjectPropertyRangeAxiom(ObjectProperty property, Description range) { + super(property, range); } - - /* (non-Javadoc) * @see org.dllearner.core.owl.KBElement#getLength() */ @@ -49,6 +47,11 @@ return null; } + @Override + public Description getRange() { + return (Description) range; + } + /* (non-Javadoc) * @see org.dllearner.core.owl.Axiom#accept(org.dllearner.core.owl.AxiomVisitor) */ @@ -62,6 +65,7 @@ */ public void accept(KBElementVisitor visitor) { visitor.visit(this); - } + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Property.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Property.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/core/owl/Property.java 2008-02-22 17:05:19 UTC (rev 628) @@ -23,6 +23,6 @@ * @author Jens Lehmann * */ -public interface Property extends KBElement { +public interface Property extends NamedKBElement { } Modified: trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/core/owl/PropertyRangeAxiom.java 2008-02-22 17:05:19 UTC (rev 628) @@ -36,5 +36,9 @@ public Property getProperty() { return property; } + + public PropertyRange getRange() { + return range; + } } Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2008-02-22 17:05:19 UTC (rev 628) @@ -140,7 +140,14 @@ kb.addAxiom(sc); } // define properties including domain and range - String kbString = "DPDOMAIN(" + getURI2("charge") + ") = " + getURI2("Atom") + "."; + String kbString = "DPDOMAIN(" + getURI2("charge") + ") = " + getURI2("Atom") + ".\n"; + kbString += "DPRANGE(" + getURI2("charge") + ") = DOUBLE.\n"; + kbString += "OPDOMAIN(" + getURI2("hasAtom") + ") = " + getURI2("Compound") + ".\n"; + kbString += "OPRANGE(" + getURI2("hasAtom") + ") = " + getURI2("Atom") + ".\n"; + kbString += "OPDOMAIN(" + getURI2("hasBond") + ") = " + getURI2("Compound") + ".\n"; + kbString += "OPRANGE(" + getURI2("hasBond") + ") = " + getURI2("Bond") + ".\n"; + kbString += "OPDOMAIN(" + getURI2("inBond") + ") = " + getURI2("Bond") + ".\n"; + kbString += "OPRANGE(" + getURI2("inBond") + ") = " + getURI2("Atom") + ".\n"; KB kb2 = KBParser.parseKBFile(kbString); kb.addKB(kb2); @@ -169,9 +176,11 @@ File confTrainFile = new File("examples/carcinogenesis/train.conf"); Files.clearFile(confTrainFile); String confHeader = "import(\"pte.owl\");\n\n"; - confHeader += "refinement.writeSearchTree = true;"; - confHeader += "refinement.searchTreeFile = \"log/carcinogenesis/searchTree.log\""; - confHeader += "reasoner = owlAPI;\n"; + confHeader += "reasoner = fastInstanceChecker;\n"; + confHeader += "algorithm = refexamples;\n"; +// confHeader += "refinement.writeSearchTree = true;"; +// confHeader += "refinement.searchTreeFile = \"log/carcinogenesis/searchTree.log\""; + confHeader += "\n\n"; Files.appendFile(confTrainFile, confHeader); // generating training examples Modified: trunk/src/dl-learner/org/dllearner/parser/kb.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-22 17:05:19 UTC (rev 628) @@ -126,7 +126,11 @@ | rBoxAxiom = ObjectPropertyDomainAxiom() { kb.addRBoxAxiom(rBoxAxiom); } | rBoxAxiom = DatatypePropertyDomainAxiom() - { kb.addRBoxAxiom(rBoxAxiom); } + { kb.addRBoxAxiom(rBoxAxiom); } + | rBoxAxiom = ObjectPropertyRangeAxiom() + { kb.addRBoxAxiom(rBoxAxiom); } + | rBoxAxiom = DatatypePropertyRangeAxiom() + { kb.addRBoxAxiom(rBoxAxiom); } // da Konfigurationsoptionen ausgeschlossen sind, reicht es bis zum "=" zu suchen | LOOKAHEAD(Concept() "=") equality = TBoxEquiv() { kb.addTBoxAxiom(equality); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-02-22 17:05:19 UTC (rev 628) @@ -108,9 +108,14 @@ */ @Override public void init() throws ComponentInitException { - rc = new DIGReasoner(sources); + rc = new OWLAPIReasoner(sources); + // DIG will only be used to get the role pairs; + // outside the constructor, OWL API will be used because + // it is fast than DIG + DIGReasoner rcDIG = new DIGReasoner(sources); try { rc.init(); + rcDIG.init(); } catch (ComponentInitException e1) { e1.printStackTrace(); } @@ -130,7 +135,7 @@ } for (ObjectProperty atomicRole : rs.getAtomicRoles()) { - opPos.put(atomicRole, rs.getRoleMembers(atomicRole)); + opPos.put(atomicRole, rcDIG.getRoleMembers(atomicRole)); } long dematDuration = System.currentTimeMillis() - dematStartTime; Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-02-22 17:05:19 UTC (rev 628) @@ -16,8 +16,6 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.FlatABox; import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.Intersection; -import org.dllearner.core.owl.Negation; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectPropertyHierarchy; import org.dllearner.core.owl.SubsumptionHierarchy; Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-22 15:18:56 UTC (rev 627) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIAxiomConvertVisitor.java 2008-02-22 17:05:19 UTC (rev 628) @@ -26,6 +26,8 @@ import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.AxiomVisitor; import org.dllearner.core.owl.ClassAssertionAxiom; +import org.dllearner.core.owl.DataRange; +import org.dllearner.core.owl.Datatype; import org.dllearner.core.owl.DatatypePropertyDomainAxiom; import org.dllearner.core.owl.DatatypePropertyRangeAxiom; import org.dllearner.core.owl.DoubleDatatypePropertyAssertion; @@ -250,26 +252,32 @@ * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.ObjectPropertyDomainAxiom) */ public void visit(ObjectPropertyDomainAxiom objectPropertyDomainAxiom) { - // TODO Auto-generated method stub - + OWLDescription d = getOWLDescription(objectPropertyDomainAxiom.getDomain()); + OWLObjectProperty op = factory.getOWLObjectProperty(URI.create(objectPropertyDomainAxiom.getProperty().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLObjectPropertyDomainAxiom(op, d); + addAxiom(axiomOWLAPI); } /* (non-Javadoc) * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.DatatypePropertyRangeAxiom) */ public void visit(DatatypePropertyRangeAxiom axiom) { - // TODO Auto-generated method stub - + DataRange dr = axiom.getRange(); + Datatype dt = (Datatype) dr; + OWLDataType odt = factory.getOWLDataType(dt.getURI()); + OWLDataProperty dp = factory.getOWLDataProperty(URI.create(axiom.getProperty().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLDataPropertyRangeAxiom(dp, odt); + addAxiom(axiomOWLAPI); } /* (non-Javadoc) * @see org.dllearner.core.owl.PropertyAxiomVisitor#visit(org.dllearner.core.owl.ObjectPropertyRangeAxiom) */ public void visit(ObjectPropertyRangeAxiom axiom) { - // TODO Auto-generated method stub - + OWLDescription d = getOWLDescription(axiom.getRange()); + OWLObjectProperty op = factory.getOWLObjectProperty(URI.create(axiom.getProperty().getName())); + OWLAxiom axiomOWLAPI = factory.getOWLObjectPropertyRangeAxiom(op, d); + addAxiom(axiomOWLAPI); } - - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |