From: <ku...@us...> - 2011-06-19 11:25:18
|
Revision: 2907 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2907&view=rev Author: kurzum Date: 2011-06-19 11:25:11 +0000 (Sun, 19 Jun 2011) Log Message: ----------- autrosparql, turned off permutations, geizhals, json error message Modified Paths: -------------- trunk/autosparql/pom.xml trunk/interfaces/src/main/java/org/dllearner/server/NKEGeizhals.java trunk/interfaces/src/main/java/org/dllearner/server/nke/Geizhals2OWL.java trunk/interfaces/src/test/java/org/dllearner/test/junit/GeizhalsTest.java Modified: trunk/autosparql/pom.xml =================================================================== --- trunk/autosparql/pom.xml 2011-06-19 08:16:41 UTC (rev 2906) +++ trunk/autosparql/pom.xml 2011-06-19 11:25:11 UTC (rev 2907) @@ -15,6 +15,7 @@ <properties> <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> + <this.usePermutations>false</this.usePermutations> </properties> <repositories> Modified: trunk/interfaces/src/main/java/org/dllearner/server/NKEGeizhals.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/server/NKEGeizhals.java 2011-06-19 08:16:41 UTC (rev 2906) +++ trunk/interfaces/src/main/java/org/dllearner/server/NKEGeizhals.java 2011-06-19 11:25:11 UTC (rev 2907) @@ -134,12 +134,20 @@ public static JSONObject jsonForEd(EvaluatedDescriptionPosNeg ed, String requestUrl) { SortedSet<NamedClass> namedClasses = getNamedClasses(ed.getDescription(), new TreeSet<NamedClass>()); - String xf = getID(ed.getDescription(), namedClasses); - String link = "http://geizhals.at/?cat=nb15w&xf=" + xf; + String link = ""; + String label = ""; + if (ed.getDescription().toKBSyntaxString().equals("TOP")) { + label = "No suggestions for current selection (click to show all)"; + link = "http://geizhals.at/?cat=nb15"; + } else { + link = "http://geizhals.at/?cat=nb15w&xf=" + getID(ed.getDescription(), namedClasses); + label = getLabel(ed.getDescription(), namedClasses); + } + JSONObject j = new JSONObject(); j.put("link", link); - j.put("label", getLabel(ed.getDescription(), namedClasses)); + j.put("label", label); j.put("truePositives", EvaluatedDescriptionPosNeg.getJSONArray(ed.getCoveredPositives())); j.put("falsePositives", EvaluatedDescriptionPosNeg.getJSONArray(ed.getNotCoveredPositives())); j.put("trueNegatives", EvaluatedDescriptionPosNeg.getJSONArray(ed.getNotCoveredNegatives())); @@ -152,6 +160,7 @@ } public static String getID(Description d, SortedSet<NamedClass> namedClasses) { + //prepare retrieval string StringBuilder sb = new StringBuilder(); int x = 0; @@ -166,6 +175,7 @@ } public static String getLabel(Description d, SortedSet<NamedClass> namedClasses) { + String mos = d.toManchesterSyntaxString(null, null); for (NamedClass nc : namedClasses) { String label = null; Modified: trunk/interfaces/src/main/java/org/dllearner/server/nke/Geizhals2OWL.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/server/nke/Geizhals2OWL.java 2011-06-19 08:16:41 UTC (rev 2906) +++ trunk/interfaces/src/main/java/org/dllearner/server/nke/Geizhals2OWL.java 2011-06-19 11:25:11 UTC (rev 2907) @@ -184,7 +184,11 @@ model.createIndividual(negative, OWL.Thing); } } catch (org.json.simple.parser.ParseException e) { - String msg = "Parsing the JSON string failed\nJSON was:\n" + json; + int position = e.getPosition(); + String msg = "Parsing the JSON string failed\n" + e.toString() + "\n"; + String before = (position >= 30) ? json.substring(position - 30, position) : json.substring(0, position); + String after = (position + 30 < json.length()) ? json.substring(position, position + 29) : json.substring(position); + msg += "String before position " + position + ": " + before + "\n" + "String after position " + position + ": " + after + "\n" + "JSON was:\n" + json; log.error(msg, e); throw new InvalidParameterException(msg); } Modified: trunk/interfaces/src/test/java/org/dllearner/test/junit/GeizhalsTest.java =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/test/junit/GeizhalsTest.java 2011-06-19 08:16:41 UTC (rev 2906) +++ trunk/interfaces/src/test/java/org/dllearner/test/junit/GeizhalsTest.java 2011-06-19 11:25:11 UTC (rev 2907) @@ -1,7 +1,6 @@ package org.dllearner.test.junit; import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; -import org.dllearner.server.NKEGeizhals; import org.dllearner.server.nke.Geizhals2OWL; import org.dllearner.server.nke.Learner; import org.dllearner.utilities.Helper; @@ -17,24 +16,28 @@ public class GeizhalsTest { - public static String i1 = "Sempron SI-40 2.00GHz • 1024MB • 120GB • DVD+/-RW DL • NVIDIA GeForce 9100M (IGP) max.256MB shared memory • 3x USB 2.0/Modem/LAN/WLAN 802.11bg • ExpressCard/54 Slot • 3in1 Card Reader (SD/MMC/MS) • Webcam (1.3 Megapixel) • 16\\\" WXGA glare TFT (1366x768) • Windows Vista Home Basic • Li-Ionen-Akku (6 Zellen) • 2.70kg • 24 Monate Herstellergarantie"; - public static String i2 = "Core 2 Duo 2x 1.86GHz • 2048MB • 128GB Flash • kein optisches Laufwerk • NVIDIA GeForce 320M (IGP) max. 256MB shared memory • 2x USB 2.0/WLAN 802.11n/Bluetooth 2.1 • Mini DisplayPort • Webcam • 13.3\\\" WSXGA glare LED TFT (1440x900) • Mac OS X 10.6 Snow Leopard inkl. iLife • Lithium-Polymer-Akku • 1.32kg • 12 Monate Herstellergarantie"; - public static String i3 = "Core i5-2410M 2x 2.30GHz • 4096MB • 500GB • DVD+/-RW DL • NVIDIA GeForce GT520M 1024MB • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn/BLuetooth 3.0 • HDMI • 5in1 Card Reader • Webcam (1.3 Megapixel) • 13.3\\\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; - public static String i4= "Pentium B940 2x 2.00GHz • 4096MB • 500GB • DVD+/-RW DL • Intel GMA HD 3000 (IGP) shared memory • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn • HDMI • 5in1 Card Reader • Webcam (1.3 Megapixel) • 13.3\\\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; - public static String i5 = "Core i3-2310M 2x 2.10GHz • 4096MB • 500GB • DVD+/-RW DL • Intel GMA HD 3000 (IGP) shared memory • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn/BLuetooth 3.0 • HDMI • 5in1 Card Reader • 13.3\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; - public static String i6 = "Core i5-2410M 2x 2.30GHz • 4096MB • 500GB • DVD+/-RW DL • NVIDIA GeForce GT520M 1024MB • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn/BLuetooth 3.0 • HDMI • 5in1 Card Reader • Webcam (1.3 Megapixel) • 13.3\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; - public static String i7 = "AMD C-50 2x 1.00GHz • 2048MB • 320GB • DVD+/-RW DL • AMD Radeon HD 6250 (IGP) shared memory • 3x USB 2.0/LAN/WLAN 802.11bgn • HDMI • 2in1 Card Reader • 15.6\" WXGA glare LED TFT 1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku • 2.60kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; + public static String[] featureDesc = new String[7]; + public static String[] jsonEx = new String[featureDesc.length]; + public static String json1 = ""; + static { - public static String json1 = ""; + featureDesc[0] = "Sempron SI-40 2.00GHz • 1024MB • 120GB • DVD+/-RW DL • NVIDIA GeForce 9100M (IGP) max.256MB shared memory • 3x USB 2.0/Modem/LAN/WLAN 802.11bg • ExpressCard/54 Slot • 3in1 Card Reader (SD/MMC/MS) • Webcam (1.3 Megapixel) • 16\\\" WXGA glare TFT (1366x768) • Windows Vista Home Basic • Li-Ionen-Akku (6 Zellen) • 2.70kg • 24 Monate Herstellergarantie"; + featureDesc[1] = "Core 2 Duo 2x 1.86GHz • 2048MB • 128GB Flash • kein optisches Laufwerk • NVIDIA GeForce 320M (IGP) max. 256MB shared memory • 2x USB 2.0/WLAN 802.11n/Bluetooth 2.1 • Mini DisplayPort • Webcam • 13.3\\\" WSXGA glare LED TFT (1440x900) • Mac OS X 10.6 Snow Leopard inkl. iLife • Lithium-Polymer-Akku • 1.32kg • 12 Monate Herstellergarantie"; + featureDesc[2] = "Core i5-2410M 2x 2.30GHz • 4096MB • 500GB • DVD+/-RW DL • NVIDIA GeForce GT520M 1024MB • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn/BLuetooth 3.0 • HDMI • 5in1 Card Reader • Webcam (1.3 Megapixel) • 13.3\\\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; + featureDesc[3] = "Pentium B940 2x 2.00GHz • 4096MB • 500GB • DVD+/-RW DL • Intel GMA HD 3000 (IGP) shared memory • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn • HDMI • 5in1 Card Reader • Webcam (1.3 Megapixel) • 13.3\\\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; + featureDesc[4] = "Core i3-2310M 2x 2.10GHz • 4096MB • 500GB • DVD+/-RW DL • Intel GMA HD 3000 (IGP) shared memory • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn/BLuetooth 3.0 • HDMI • 5in1 Card Reader • 13.3\\\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; + featureDesc[5] = "Core i5-2410M 2x 2.30GHz • 4096MB • 500GB • DVD+/-RW DL • NVIDIA GeForce GT520M 1024MB • 3x USB (2x USB 2.0, 1x USB 3.0)/Gb LAN/WLAN 802.11bgn/BLuetooth 3.0 • HDMI • 5in1 Card Reader • Webcam (1.3 Megapixel) • 13.3\\\" WXGA glare LED TFT (1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku (6 Zellen) • 2.10kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; + featureDesc[6] = "AMD C-50 2x 1.00GHz • 2048MB • 320GB • DVD+/-RW DL • AMD Radeon HD 6250 (IGP) shared memory • 3x USB 2.0/LAN/WLAN 802.11bgn • HDMI • 2in1 Card Reader • 15.6\\\" WXGA glare LED TFT 1366x768) • Windows 7 Home Premium (64-bit) • Li-Ionen-Akku • 2.60kg • 24 Monate Herstellergarantie • Besonderheiten: Nummernblock"; - static { - i1 = " [\"http://test.de/p1\",\"ignore1\", \"" + i1 + "\" ] "; - i2 = " [\"http://test.de/p2\",\"ignore1\", \"" + i2 + "\" ] "; - i3 = " [\"http://test.de/n1\",\"ignore1\", \"" + i3 + "\" ] "; - i4 = " [\"http://test.de/n2\",\"ignore1\", \"" + i4 + "\" ] "; - json1 = "{" + "\"pos\": [ " + i1 + " , " + i2 + " ] , " + "\"neg\": [ " + i3 + " , " + i4 + " ] " + " }"; + for (int x = 0; x < featureDesc.length; x++) + { + jsonEx[x] = " [\"http://test.de/x" + (x) + "\",\"ignore1\", \"" + featureDesc[x] + "\" ] "; + + } + + //json1 = "{" + "\"pos\": [ " + i1 + " , " + i2 + " ] , " + "\"neg\": [ " + i3 + " , " + i4 + " ] " + " }";*/ } @@ -53,15 +56,18 @@ @Test public void learn() throws Exception { // Logger.getRootLogger().setLevel(Level.TRACE); - System.out.println(json1); + //System.out.println(json1); Geizhals2OWL g = Geizhals2OWL.getInstance(); - Geizhals2OWL.Result result = g.handleJson(json1); - Learner l = new Learner(); - long start = System.nanoTime(); - EvaluatedDescriptionPosNeg ed = l.learn(result.pos, result.neg, result.getModel(), 20); - long duration = System.nanoTime() - start; - System.out.println("total time: " + Helper.prettyPrintNanoSeconds(duration)); - System.out.println(ed.asJSON()); -// System.out.println(NKEGeizhals.jsonForEd(ed).toJSONString()); + + for (int x = 1; x < jsonEx.length; x++) { + String json = "{" + "\"pos\": [ " + jsonEx[x - 1] + " ] , " + "\"neg\": [ " + jsonEx[x] + " ] " + " }"; + Geizhals2OWL.Result result = g.handleJson(json); + Learner l = new Learner(); + long start = System.nanoTime(); + EvaluatedDescriptionPosNeg ed = l.learn(result.pos, result.neg, result.getModel(), 20); + long duration = System.nanoTime() - start; + System.out.println("total time: " + Helper.prettyPrintNanoSeconds(duration)); + System.out.println(ed.asJSON()); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |