# HG changeset patch # User dwinter # Date 1297093898 -3600 # Node ID 923e73fa07f1429c92967d6e5c542708277ce599 # Parent 72004a788198ff20028a83a3da0bd2ebe6672c7b Minor changes, Suche nach Objekten nach readableId jetzt einschraenkbar, nicht auf subclassen ausweiten. diff -r 72004a788198 -r 923e73fa07f1 owlInput/ecrm_101001.owl --- a/owlInput/ecrm_101001.owl Sun Feb 06 21:19:48 2011 +0100 +++ b/owlInput/ecrm_101001.owl Mon Feb 07 16:51:38 2011 +0100 @@ -129,12 +129,12 @@ - the destruction of Nineveh (E6, E7) + + + - - - @@ -156,28 +156,28 @@ - 1 + 1 - + - 1 + 1 @@ -256,12 +256,12 @@ + + + - - - @@ -342,22 +342,22 @@ + + + - - - + + + - - - Scope note: @@ -387,12 +387,12 @@ + + + - - - @@ -465,21 +465,21 @@ + 1 - 1 + + + - - - @@ -511,12 +511,12 @@ + + + - - - Scope note: @@ -532,29 +532,29 @@ - 2 + 2 - 1 + 1 - 0 + 0 @@ -637,31 +637,31 @@ - the Mona Lisa (E22) - - - 1 - - - - - - - - + - + + + + + + + + + + + @@ -688,11 +688,11 @@ + 1 - 1 @@ -742,12 +742,12 @@ + + + - - - @@ -757,11 +757,11 @@ + 1 - 1 @@ -873,11 +873,11 @@ - 1 + 1 @@ -949,10 +949,10 @@ - + Scope note: @@ -970,20 +970,20 @@ + + + - - - + - Scope note: @@ -997,10 +997,10 @@ + - @@ -1051,11 +1051,11 @@ - 1 + 1 Scope note: @@ -1121,18 +1121,18 @@ - + + - @@ -1181,12 +1181,12 @@ + + + - - - Scope note: @@ -1245,10 +1245,10 @@ + - @@ -1320,10 +1320,10 @@ + - @@ -1380,11 +1380,11 @@ - 1 + 1 @@ -1442,11 +1442,11 @@ + 1 - 1 Scope note: @@ -1597,10 +1597,10 @@ - the return of Picasso’s "Guernica" to Madrid’s Prado in 1981 - + @@ -1726,10 +1726,10 @@ - + @@ -1749,20 +1749,20 @@ - 1 + 1 + 1 - 1 @@ -1788,10 +1788,10 @@ - + @@ -1832,10 +1832,10 @@ - + @@ -1850,10 +1850,10 @@ - the Doomsday Book + - @@ -3541,17 +3541,6 @@ - - Scope note: -This property describes the inclusion relationship between two instances of E52 Time-Span. -This property supports the notion that a Time-Span’s temporal extent falls within the temporal extent of another Time-Span. It addresses temporal containment only, and no contextual link between the two instances of Time-Span is implied. - -Examples: -- the time-span of the Apollo 11 moon mission (E52) falls within the time-span of the reign of Queen Elizabeth II (E52) - - - - @@ -3565,22 +3554,33 @@ Examples: - the first book of the Old Testament (E33) has title “Genesis” (E35) has type translated (E55) + + Scope note: +This property describes the inclusion relationship between two instances of E52 Time-Span. +This property supports the notion that a Time-Span’s temporal extent falls within the temporal extent of another Time-Span. It addresses temporal containment only, and no contextual link between the two instances of Time-Span is implied. + +Examples: +- the time-span of the Apollo 11 moon mission (E52) falls within the time-span of the reign of Queen Elizabeth II (E52) + + + + - - - - - + + + + + diff -r 72004a788198 -r 923e73fa07f1 owlInput/knowledgeRepresenatation.owl --- a/owlInput/knowledgeRepresenatation.owl Sun Feb 06 21:19:48 2011 +0100 +++ b/owlInput/knowledgeRepresenatation.owl Mon Feb 07 16:51:38 2011 +0100 @@ -28,25 +28,25 @@ + 1 - + 1 - - 1 + 1 @@ -64,11 +64,11 @@ - 1 + 1 @@ -88,9 +88,18 @@ + 1 + + + + + + + 1 @@ -100,17 +109,8 @@ 1 - - - - - - - - 1 @@ -325,13 +325,13 @@ + + + - - - @@ -339,14 +339,14 @@ - + - + diff -r 72004a788198 -r 923e73fa07f1 protege.properties --- a/protege.properties Sun Feb 06 21:19:48 2011 +0100 +++ b/protege.properties Mon Feb 07 16:51:38 2011 +0100 @@ -1,5 +1,5 @@ #Protege Properties -#Sun Feb 06 20:57:42 CET 2011 +#Mon Feb 07 16:27:10 CET 2011 +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 -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 OntURIBase=http\://www.owl-ontologies.com diff -r 72004a788198 -r 923e73fa07f1 src/de/mpiwg/dwinter/duomo/lexdump/LexOWLTransformer.java --- a/src/de/mpiwg/dwinter/duomo/lexdump/LexOWLTransformer.java Sun Feb 06 21:19:48 2011 +0100 +++ b/src/de/mpiwg/dwinter/duomo/lexdump/LexOWLTransformer.java Mon Feb 07 16:51:38 2011 +0100 @@ -63,6 +63,13 @@ * @throws Exception */ public static void main(String[] args) throws Exception { + System.out.println("Stack size has to be large, use at lease -Xss=2024k!"); + if (args.length<2){ + System.out.println("Usage: \"/Users/dwinter/Documents/Projekte/Diss - data-mining/eclipseWorkspace/de.mpiwg.dwinter.duomo/owlInput\""+ + "\"/Users/dwinter/Documents/Projekte/Diss - data-mining/eclipseWorkspace/duomoData/LEXXDUMP.xml\""); + System.exit(-1); + } + Logger.getRootLogger().setLevel(Level.DEBUG); // Import OWL //String base = "/Users/dwinter/Documents/Projekte/Diss - data-mining/eclipseWorkspace/de.mpiwg.dwinter.duomo/owlInput"; @@ -99,7 +106,7 @@ LexOWLTransformer tf = new LexOWLTransformer(owlDoc, lexDoc); tf.transform(); - //owlDoc.save("file:///tmp/out.owl"); + owlDoc.save("file:///tmp/out.owl"); } private void transform() throws URISyntaxException, Exception { @@ -145,11 +152,11 @@ // record-tag } } - owlDoc.save("/tmp/out"+String.valueOf(signatureCount)+".owl"); - logger.debug("Saved:"+"/tmp/out"+String.valueOf(signatureCount)+".owl"); - owlDoc.reloadOWL(); + //owlDoc.save("file:///tmp/out"+String.valueOf(signatureCount)+".owl"); + //logger.debug("Saved:"+"/tmp/out"+String.valueOf(signatureCount)+".owl"); + //owlDoc.reloadOWL(); } - //owlDoc.printModel(); + owlDoc.printModel(); } private OWLIndividual createEvent(Element record, OWLIndividual recordInd) { @@ -324,6 +331,7 @@ logger.debug("target ID does not exist:" + subjPointer); try { missing.write("target ID does not exist:" + subjPointer+"\n"); + missing.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -464,7 +472,7 @@ } private OWLIndividual createOrGetTipol(String typology) { - OWLIndividual tipol = owlDoc.createOrGetInstanceWithIdentifier("Typology","Identifier",typology); + OWLIndividual tipol = owlDoc.createOrGetInstanceWithIdentifier("Typology","Identifier",typology,false); return tipol; } @@ -482,18 +490,18 @@ } private OWLIndividual createOrGetInstitution(String name) { - OWLIndividual nameInd = owlDoc.createOrGetInstanceWithIdentifier("IndicesInstitutions","IdentifierInstitutions",name); + OWLIndividual nameInd = owlDoc.createOrGetInstanceWithIdentifier("IndicesInstitutions","IdentifierInstitutions",name,false); return nameInd; } private OWLIndividual createOrGetName(String name) { - OWLIndividual nameInd = owlDoc.createOrGetInstanceWithIdentifier("IndicesNames","IdentifierNames",name); + OWLIndividual nameInd = owlDoc.createOrGetInstanceWithIdentifier("IndicesNames","IdentifierNames",name,false); return nameInd; } private OWLIndividual createOrGetRole(String name) { - OWLIndividual roleInd = owlDoc.createOrGetInstanceWithIdentifier("IndicesRoles","IdentifierRoles",name); + OWLIndividual roleInd = owlDoc.createOrGetInstanceWithIdentifier("IndicesRoles","IdentifierRoles",name,false); return roleInd; } diff -r 72004a788198 -r 923e73fa07f1 src/de/mpiwg/dwinter/duomo/lexdump/OWLImporter.java --- a/src/de/mpiwg/dwinter/duomo/lexdump/OWLImporter.java Sun Feb 06 21:19:48 2011 +0100 +++ b/src/de/mpiwg/dwinter/duomo/lexdump/OWLImporter.java Mon Feb 07 16:51:38 2011 +0100 @@ -1,6 +1,8 @@ package de.mpiwg.dwinter.duomo.lexdump; import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -30,6 +32,7 @@ JenaOWLModel owlModel; // contains the model Logger logger = Logger.getRootLogger(); + FileWriter fh; private HashMap typeId2className=null; private HashMap typeId2class=null; private String ontFolder; @@ -40,7 +43,12 @@ this.ontFolder=folder; this.uri=uri; - + try { + this.fh= new FileWriter(new File("/tmp/identifier")); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } loadOWL(folder, uri); } @@ -142,14 +150,24 @@ return value; } + public OWLIndividual getIndividual(String classNameFrom, String propertyNameToClass, String classNameTo, String propertyName2, Object value) { + return getIndividual(classNameFrom, + propertyNameToClass, classNameTo, + propertyName2, value, true); + } + + + public OWLIndividual getIndividual(String classNameFrom, + String propertyNameToClass, String classNameTo, + String propertyName2, Object value,boolean subclasses) { RDFProperty prop = owlModel.getRDFProperty(propertyName2); OWLClass classTo = owlModel.getOWLNamedClass(classNameTo); - Collection instances = classTo.getInstances(true); + Collection instances = classTo.getInstances(subclasses); OWLIndividual toIv = null; // Such individiual mit propertyName2 und Wert value for (Iterator jt = instances.iterator(); jt.hasNext();) { @@ -270,7 +288,11 @@ } public OWLIndividual getIndividualByReadableId(String className,String identifier){ - return getIndividual(className, "crm:P48_has_preferred_identifier", "Identifier", "has_readable_id", identifier); + return getIndividual(className, "crm:P48_has_preferred_identifier", "Identifier", "has_readable_id", identifier, true); + } + + public OWLIndividual getIndividualByReadableId(String className,String identifier, String classNameIdentifier,boolean subclassedIdentifier){ + return getIndividual(className, "crm:P48_has_preferred_identifier", classNameIdentifier, "has_readable_id", identifier,subclassedIdentifier); } public String getClassNameFromTypeId(String typeId) { @@ -314,12 +336,19 @@ } public OWLIndividual createOrGetInstanceWithIdentifier(String classNameInstance, - String classNameIdentifier, String identifier) { - OWLIndividual ind = getIndividualByReadableId(classNameInstance, identifier); + String classNameIdentifier, String identifier,boolean followSubclasses) { + OWLIndividual ind = getIndividualByReadableId(classNameInstance, identifier,classNameIdentifier,followSubclasses); if(ind==null){ ind = createInstance(classNameInstance); OWLIndividual identifierInd = createInstance(classNameIdentifier); setProperty(identifierInd, "has_readable_id", identifier); + try { + fh.write(classNameInstance+" --" +classNameIdentifier+"---"+identifier+"\n"); + fh.flush(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } setProperty(ind, "crm:P48_has_preferred_identifier", identifierInd); }