# HG changeset patch # User dwinter # Date 1296745686 -3600 # Node ID 273164f8192629e7a967b81378ea5dc4cf1a9281 # Parent 0fa29ab5e5e07ba7915c980fa4a59d15cd584823 bug in transformer handleroles diff -r 0fa29ab5e5e0 -r 273164f81926 protege.properties --- a/protege.properties Thu Feb 03 14:05:52 2011 +0100 +++ b/protege.properties Thu Feb 03 16:08:06 2011 +0100 @@ -1,5 +1,5 @@ #Protege Properties -#Thu Feb 03 10:05:31 CET 2011 +#Thu Feb 03 16:04:20 CET 2011 +SwitchableClassDefinitionType=edu.stanford.smi.protegex.owl.ui.cls.LogicClassDefinitionWidgetType history.projects.reopen=file\:/Users/dwinter/Documents/Projekte/Diss%20-%20data-mining/eclipseWorkspace/de.mpiwg.dwinter.duomo/examples/newspaper/newspaper.pprj,file\:/Users/dwinter/Documents/Projekte/Diss%20-%20data-mining/eclipseWorkspace/de.mpiwg.dwinter.duomo/examples/sqwrl/SQWRLExamples.pprj,file\:/Users/dwinter/Documents/Projekte/Diss%20-%20data-mining/eclipseWorkspace/de.mpiwg.dwinter.duomo/examples/pizza/pizza.owl.pprj -SwitchableClassDefinitionType=edu.stanford.smi.protegex.owl.ui.cls.LogicClassDefinitionWidgetType OntURIBase=http\://www.owl-ontologies.com diff -r 0fa29ab5e5e0 -r 273164f81926 src/de/mpiwg/dwinter/duomo/lexdump/LexOWLTransformer.java --- a/src/de/mpiwg/dwinter/duomo/lexdump/LexOWLTransformer.java Thu Feb 03 14:05:52 2011 +0100 +++ b/src/de/mpiwg/dwinter/duomo/lexdump/LexOWLTransformer.java Thu Feb 03 16:08:06 2011 +0100 @@ -54,7 +54,7 @@ public LexOWLTransformer(OWLImporter owlDoc, LexDumpImporter lexDoc) throws IOException { this.owlDoc = owlDoc; this.lexDoc = lexDoc; - missing = new FileWriter(new File("/tmp/missing.out","w")); + missing = new FileWriter(new File("/tmp/missing.out")); } /** @@ -206,9 +206,9 @@ if (!name.equals("") && !role.equals("")) { recordNamesRoles = handleNameWithRole(recordInd, name, role); } else if (!role.equals("")) { - recordNamesRoles = handleRole(recordInd, role); + recordNamesRoles = createOrGetRole(role); } else if (!name.equals("")) { - recordNamesRoles = handleName(recordInd, name); + recordNamesRoles = createOrGetName(name); } if (recordNamesRoles != null) { @@ -401,25 +401,7 @@ return toClass; } - private OWLIndividual handleRole(OWLIndividual recordInd, String role) { - OWLIndividual roleInd = owlDoc.getIndividualByReadableId( - "IndicesRoles", role); - if (roleInd == null) { - roleInd = createRole(role); - } - - return roleInd; - } - - private OWLIndividual handleName(OWLIndividual recordInd, String name) { - OWLIndividual nameInd = owlDoc.getIndividualByReadableId( - "IndicesNames", name); - if (nameInd == null) { - nameInd = createRole(name); - } - - return nameInd; - } + private OWLIndividual handleNameWithRole(OWLIndividual recordInd, String name, String role) { @@ -436,7 +418,7 @@ OWLIndividual roleInd = owlDoc.getIndividualByReadableId( "IndicesRoles", role); if (roleInd == null) { - roleInd = createRole(role); + roleInd = createOrGetRole(role); createNewNameWithRole = true; // role existierte nicht dann kann // auch NameWithRole nicht // existierten. @@ -503,7 +485,7 @@ return nameInd; } - private OWLIndividual createRole(String name) { + private OWLIndividual createOrGetRole(String name) { OWLIndividual roleInd = owlDoc.createOrGetInstanceWithIdentifier("IndicesRoles","IdentifierRoles",name); return roleInd; } diff -r 0fa29ab5e5e0 -r 273164f81926 src/de/mpiwg/dwinter/duomo/lexdump/OWLImporter.java --- a/src/de/mpiwg/dwinter/duomo/lexdump/OWLImporter.java Thu Feb 03 14:05:52 2011 +0100 +++ b/src/de/mpiwg/dwinter/duomo/lexdump/OWLImporter.java Thu Feb 03 16:08:06 2011 +0100 @@ -310,6 +310,6 @@ setProperty(ind, "crm:P48_has_preferred_identifier", identifier); } - return null; + return ind; } }