From: <jen...@us...> - 2010-02-13 17:21:09
|
Revision: 2031 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2031&view=rev Author: jenslehmann Date: 2010-02-13 17:20:57 +0000 (Sat, 13 Feb 2010) Log Message: ----------- hasValue support for KBParser Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/StringValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java trunk/src/dl-learner/org/dllearner/parser/ConfParser.java trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.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/KBParserConstants.java trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/PrologParser.java trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java trunk/src/dl-learner/org/dllearner/parser/PrologParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/kb.jj Added Paths: ----------- trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java Modified: trunk/src/dl-learner/org/dllearner/core/owl/StringValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/StringValueRestriction.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/core/owl/StringValueRestriction.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -19,6 +19,8 @@ */ package org.dllearner.core.owl; +import java.util.Map; + /** * * String value restriction, e.g. \exists description hasValue "interesting item". @@ -47,4 +49,7 @@ return stringValue; } + public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) { + return "(" + restrictedPropertyExpression.toKBSyntaxString(baseURI, prefixes) + " STRINGVALUE " + value.toKBSyntaxString(baseURI, prefixes) + ")"; + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -56,7 +56,7 @@ } public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) { - return literal; + return "\"" + literal + "\""; // return literal + "^^" + datatype; } Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -168,7 +168,7 @@ // n.dump(""); // System.out.println("Thank you."); } catch (Exception e) { - System.out.println("\nParse exception occurred. Please follow the advise given below."); + System.out.println("\u005cnParse exception occurred. Please follow the advise given below."); System.out.println(e.getMessage()); e.printStackTrace(); System.exit(0); @@ -944,7 +944,7 @@ for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } - jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) { int[] oldentry = (int[])(it.next()); if (oldentry.length == jj_expentry.length) { for (int i = 0; i < jj_expentry.length; i++) { Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -2,10 +2,11 @@ package org.dllearner.parser; -/** +/** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ +@SuppressWarnings("all") public interface ConfParserConstants { /** End of File. */ Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -16,8 +16,8 @@ import org.dllearner.cli.*; import org.dllearner.utilities.datastructures.*; +/** Token Manager. */ @SuppressWarnings("all") -/** Token Manager. */ public class ConfParserTokenManager implements ConfParserConstants { @@ -122,7 +122,7 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(0, old0); + return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); @@ -148,7 +148,7 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(1, old0); + return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); @@ -166,7 +166,7 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(2, old0); + return jjStartNfa_0(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); @@ -184,7 +184,7 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0); + return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); @@ -589,7 +589,7 @@ /** Lexer state names. */ public static final String[] lexStateNames = { - "DEFAULT", + "DEFAULT", }; static final long[] jjtoToken = { 0x1ffffff01L, @@ -685,13 +685,13 @@ EOFLoop : for (;;) - { - try - { + { + try + { curChar = input_stream.BeginToken(); - } + } catch(java.io.IOException e) - { + { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; Modified: trunk/src/dl-learner/org/dllearner/parser/KBParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -494,15 +494,22 @@ jj_consume_token(48); jj_consume_token(23); {if (true) return new BooleanValueRestriction(dp, true);} + } else if (jj_2_9(4)) { + jj_consume_token(22); + dp = DatatypeProperty(); + jj_consume_token(47); + jj_consume_token(49); + jj_consume_token(23); + {if (true) return new BooleanValueRestriction(dp, false);} } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 22: jj_consume_token(22); dp = DatatypeProperty(); - jj_consume_token(47); - jj_consume_token(49); + jj_consume_token(50); + s = String(); jj_consume_token(23); - {if (true) return new BooleanValueRestriction(dp, false);} + {if (true) return new StringValueRestriction(dp, s);} break; default: jj_la1[11] = jj_gen; @@ -716,6 +723,13 @@ finally { jj_save(7, xla); } } + private boolean jj_2_9(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_9(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(8, xla); } + } + private boolean jj_3_7() { if (jj_scan_token(22)) return true; if (jj_3R_2()) return true; @@ -793,7 +807,7 @@ } private boolean jj_3R_18() { - if (jj_3R_27()) return true; + if (jj_3R_26()) return true; return false; } @@ -837,6 +851,8 @@ jj_scanpos = xsp; if (jj_3_8()) { jj_scanpos = xsp; + if (jj_3_9()) { + jj_scanpos = xsp; if (jj_3R_16()) return true; } } @@ -849,21 +865,22 @@ } } } + } return false; } - private boolean jj_3R_26() { + private boolean jj_3R_27() { if (jj_scan_token(ID)) return true; return false; } private boolean jj_3R_20() { - if (jj_3R_27()) return true; + if (jj_3R_26()) return true; return false; } private boolean jj_3R_17() { - if (jj_3R_26()) return true; + if (jj_3R_27()) return true; return false; } @@ -898,12 +915,12 @@ } private boolean jj_3R_24() { - if (jj_3R_27()) return true; + if (jj_3R_26()) return true; return false; } private boolean jj_3R_19() { - if (jj_3R_26()) return true; + if (jj_3R_27()) return true; return false; } @@ -918,12 +935,12 @@ } private boolean jj_3R_22() { - if (jj_3R_27()) return true; + if (jj_3R_26()) return true; return false; } private boolean jj_3R_23() { - if (jj_3R_26()) return true; + if (jj_3R_27()) return true; return false; } @@ -938,7 +955,7 @@ } private boolean jj_3R_21() { - if (jj_3R_26()) return true; + if (jj_3R_27()) return true; return false; } @@ -952,7 +969,7 @@ return false; } - private boolean jj_3R_27() { + private boolean jj_3R_26() { if (jj_scan_token(STRING)) return true; return false; } @@ -960,6 +977,15 @@ private boolean jj_3R_16() { if (jj_scan_token(22)) return true; if (jj_3R_6()) return true; + if (jj_scan_token(50)) return true; + if (jj_3R_26()) return true; + if (jj_scan_token(23)) return true; + return false; + } + + private boolean jj_3_9() { + if (jj_scan_token(22)) return true; + if (jj_3R_6()) return true; if (jj_scan_token(47)) return true; if (jj_scan_token(49)) return true; if (jj_scan_token(23)) return true; @@ -1017,7 +1043,7 @@ private static void jj_la1_init_1() { jj_la1_1 = new int[] {0xffd,0xffd,0x0,0x2,0x1c,0x60,0x380,0xc00,0x7000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } - final private JJCalls[] jj_2_rtns = new JJCalls[8]; + final private JJCalls[] jj_2_rtns = new JJCalls[9]; private boolean jj_rescan = false; private int jj_gc = 0; @@ -1182,7 +1208,7 @@ for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } - jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) { int[] oldentry = (int[])(it.next()); if (oldentry.length == jj_expentry.length) { for (int i = 0; i < jj_expentry.length; i++) { @@ -1201,7 +1227,7 @@ /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); - boolean[] la1tokens = new boolean[50]; + boolean[] la1tokens = new boolean[51]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; @@ -1218,7 +1244,7 @@ } } } - for (int i = 0; i < 50; i++) { + for (int i = 0; i < 51; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; @@ -1245,7 +1271,7 @@ private void jj_rescan_token() { jj_rescan = true; - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 9; i++) { try { JJCalls p = jj_2_rtns[i]; do { @@ -1260,6 +1286,7 @@ case 5: jj_3_6(); break; case 6: jj_3_7(); break; case 7: jj_3_8(); break; + case 8: jj_3_9(); break; } } p = p.next; Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -2,10 +2,11 @@ package org.dllearner.parser; -/** +/** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ +@SuppressWarnings("all") public interface KBParserConstants { /** End of File. */ @@ -100,6 +101,7 @@ "\"IS\"", "\"TRUE\"", "\"FALSE\"", + "\"STRINGVALUE\"", }; } Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -4,8 +4,8 @@ import java.io.*; import java.net.URL; +/** Token Manager. */ @SuppressWarnings("all") -/** Token Manager. */ public class KBParserTokenManager implements KBParserConstants { @@ -18,7 +18,7 @@ switch (pos) { case 0: - if ((active0 & 0x34c000000L) != 0L) + if ((active0 & 0x400034c000000L) != 0L) return 10; if ((active0 & 0x2000020000000L) != 0L) return 18; @@ -72,7 +72,7 @@ case 82: return jjMoveStringLiteralDfa1_0(0x8000000000L); case 83: - return jjMoveStringLiteralDfa1_0(0x34c000000L); + return jjMoveStringLiteralDfa1_0(0x400034c000000L); case 84: return jjMoveStringLiteralDfa1_0(0x1000010001000L); default : @@ -112,6 +112,8 @@ if ((active0 & 0x800000000000L) != 0L) return jjStopAtPos(1, 47); break; + case 84: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L); case 85: return jjMoveStringLiteralDfa2_0(active0, 0x20c000000L); case 110: @@ -130,7 +132,7 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(0, old0); + return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); @@ -164,7 +166,7 @@ return jjStopAtPos(2, 12); break; case 82: - return jjMoveStringLiteralDfa3_0(active0, 0x50000000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x4050000000000L); case 84: return jjMoveStringLiteralDfa3_0(active0, 0x484000002000L); case 85: @@ -187,7 +189,7 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(1, old0); + return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); @@ -207,6 +209,8 @@ return jjMoveStringLiteralDfa4_0(active0, 0x421000000000L); case 71: return jjMoveStringLiteralDfa4_0(active0, 0x8000000000L); + case 73: + return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L); case 76: return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L); case 79: @@ -233,7 +237,7 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(2, old0); + return jjStartNfa_0(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); @@ -258,7 +262,7 @@ case 77: return jjMoveStringLiteralDfa5_0(active0, 0x2800000000L); case 78: - return jjMoveStringLiteralDfa5_0(active0, 0x50000000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x4050000000000L); case 79: return jjMoveStringLiteralDfa5_0(active0, 0x200002000L); case 84: @@ -281,7 +285,7 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0); + return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); @@ -296,7 +300,7 @@ return jjStopAtPos(5, 44); return jjMoveStringLiteralDfa6_0(active0, 0x400000000000L); case 71: - return jjMoveStringLiteralDfa6_0(active0, 0x50000000000L); + return jjMoveStringLiteralDfa6_0(active0, 0x4050000000000L); case 77: if ((active0 & 0x2000L) != 0L) return jjStopAtPos(5, 13); @@ -325,7 +329,7 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(4, old0); + return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); @@ -355,6 +359,8 @@ break; case 83: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L); + case 86: + return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L); case 101: if ((active0 & 0x80000000L) != 0L) return jjStopAtPos(6, 31); @@ -375,7 +381,7 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(5, old0); + return jjStartNfa_0(5, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0); @@ -383,6 +389,8 @@ } switch(curChar) { + case 65: + return jjMoveStringLiteralDfa8_0(active0, 0x4000000000000L); case 69: return jjMoveStringLiteralDfa8_0(active0, 0x84200000000L); case 78: @@ -407,7 +415,7 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(6, old0); + return jjStartNfa_0(6, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0); @@ -415,6 +423,8 @@ } switch(curChar) { + case 76: + return jjMoveStringLiteralDfa9_0(active0, 0x4000000000000L); case 79: return jjMoveStringLiteralDfa9_0(active0, 0x21004000000L); case 80: @@ -435,7 +445,7 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(7, old0); + return jjStartNfa_0(7, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0); @@ -453,6 +463,8 @@ return jjMoveStringLiteralDfa10_0(active0, 0x84000000000L); case 84: return jjMoveStringLiteralDfa10_0(active0, 0x200000000L); + case 85: + return jjMoveStringLiteralDfa10_0(active0, 0x4000000000000L); case 101: if ((active0 & 0x10000000L) != 0L) return jjStopAtPos(9, 28); @@ -469,7 +481,7 @@ private int jjMoveStringLiteralDfa10_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(8, old0); + return jjStartNfa_0(8, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(9, active0); @@ -478,6 +490,8 @@ switch(curChar) { case 69: + if ((active0 & 0x4000000000000L) != 0L) + return jjStopAtPos(10, 50); return jjMoveStringLiteralDfa11_0(active0, 0x21000000000L); case 79: return jjMoveStringLiteralDfa11_0(active0, 0x84200000000L); @@ -489,7 +503,7 @@ private int jjMoveStringLiteralDfa11_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(9, old0); + return jjStartNfa_0(9, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(10, active0); @@ -513,7 +527,7 @@ private int jjMoveStringLiteralDfa12_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(10, old0); + return jjStartNfa_0(10, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(11, active0); @@ -533,7 +547,7 @@ private int jjMoveStringLiteralDfa13_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(11, old0); + return jjStartNfa_0(11, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(12, active0); @@ -553,7 +567,7 @@ private int jjMoveStringLiteralDfa14_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(12, old0); + return jjStartNfa_0(12, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(13, active0); @@ -575,7 +589,7 @@ private int jjMoveStringLiteralDfa15_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(13, old0); + return jjStartNfa_0(13, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(14, active0); @@ -597,7 +611,7 @@ private int jjMoveStringLiteralDfa16_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(14, old0); + return jjStartNfa_0(14, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(15, active0); @@ -621,7 +635,7 @@ private int jjMoveStringLiteralDfa17_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(15, old0); + return jjStartNfa_0(15, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(16, active0); @@ -643,7 +657,7 @@ private int jjMoveStringLiteralDfa18_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(16, old0); + return jjStartNfa_0(16, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(17, active0); @@ -669,7 +683,7 @@ private int jjMoveStringLiteralDfa19_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(17, old0); + return jjStartNfa_0(17, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(18, active0); @@ -693,7 +707,7 @@ private int jjMoveStringLiteralDfa20_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(18, old0); + return jjStartNfa_0(18, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(19, active0); @@ -715,7 +729,7 @@ private int jjMoveStringLiteralDfa21_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(19, old0); + return jjStartNfa_0(19, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(20, active0); @@ -1124,14 +1138,15 @@ "\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", "\111\123", "\124\122\125\105", "\106\101\114\123\105", }; +"\111\116\124\105\107\105\122", "\111\123", "\124\122\125\105", "\106\101\114\123\105", +"\123\124\122\111\116\107\126\101\114\125\105", }; /** Lexer state names. */ public static final String[] lexStateNames = { - "DEFAULT", + "DEFAULT", }; static final long[] jjtoToken = { - 0x3ffffffffff01L, + 0x7ffffffffff01L, }; static final long[] jjtoSkip = { 0xfeL, @@ -1224,13 +1239,13 @@ EOFLoop : for (;;) - { - try - { + { + try + { curChar = input_stream.BeginToken(); - } + } catch(java.io.IOException e) - { + { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; Modified: trunk/src/dl-learner/org/dllearner/parser/PrologParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/PrologParser.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/PrologParser.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -736,7 +736,7 @@ for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } - jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) { int[] oldentry = (int[])(it.next()); if (oldentry.length == jj_expentry.length) { for (int i = 0; i < jj_expentry.length; i++) { Modified: trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -2,10 +2,11 @@ package org.dllearner.parser; -/** +/** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ +@SuppressWarnings("all") public interface PrologParserConstants { /** End of File. */ Modified: trunk/src/dl-learner/org/dllearner/parser/PrologParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/PrologParserTokenManager.java 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/PrologParserTokenManager.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -2,6 +2,7 @@ package org.dllearner.parser; /** Token Manager. */ +@SuppressWarnings("all") public class PrologParserTokenManager implements PrologParserConstants { @@ -96,7 +97,7 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) - return jjStartNfa_0(0, old0); + return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); @@ -465,7 +466,7 @@ /** Lexer state names. */ public static final String[] lexStateNames = { - "DEFAULT", + "DEFAULT", }; static final long[] jjtoToken = { 0xff87b81L, @@ -565,13 +566,13 @@ EOFLoop : for (;;) - { - try - { + { + try + { curChar = input_stream.BeginToken(); - } + } catch(java.io.IOException e) - { + { jjmatchedKind = 0; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; Modified: trunk/src/dl-learner/org/dllearner/parser/kb.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/kb.jj 2010-02-13 17:13:49 UTC (rev 2030) +++ trunk/src/dl-learner/org/dllearner/parser/kb.jj 2010-02-13 17:20:57 UTC (rev 2031) @@ -262,12 +262,12 @@ | LOOKAHEAD(2) ac = AtomicConcept() {return ac;} // | s=Id() {return new AtomicConcept(s);} // | s=String() {return new AtomicConcept(s);} - // Parser geht bis zum n�chsten AND oder OR + // parse until next AND or OR | LOOKAHEAD( "(" Concept() And()) "(" c1=Concept() And() c2=Concept() ")" {return new Intersection(c1,c2);} | LOOKAHEAD( "(" Concept() Or()) "(" c1=Concept() Or() c2=Concept() ")" {return new Union(c1,c2);} - // EXISTS oder ALL reicht aus um richtigen Zweig zu w�hlen + // EXISTS or ALL is sufficient to chose the correct parser branch // | Exists() s=Id() "." c=Concept() // {return new Exists(new AtomicRole(s),c); } | Exists() ar=ObjectProperty() "." c=Concept() @@ -287,7 +287,8 @@ | LE() i=Integer() ar=ObjectProperty() "." c=Concept() {return new ObjectMaxCardinalityRestriction(i,ar,c);} | LOOKAHEAD(4) "(" dp=DatatypeProperty() "IS" "TRUE" ")" { return new BooleanValueRestriction(dp, true); } - | "(" dp=DatatypeProperty() "IS" "FALSE" ")" { return new BooleanValueRestriction(dp, false); } + | LOOKAHEAD(4) "(" dp=DatatypeProperty() "IS" "FALSE" ")" { return new BooleanValueRestriction(dp, false); } + | "(" dp=DatatypeProperty() "STRINGVALUE" s=String() ")" { return new StringValueRestriction(dp, s); } } void Or() : {} { <OR> } Added: trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java 2010-02-13 17:20:57 UTC (rev 2031) @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2007-2009, 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 org.dllearner.core.owl.Description; +import org.dllearner.parser.KBParser; +import org.dllearner.parser.ParseException; +import org.junit.Test; + +/** + * Tests for various parsers in DL-Learner. + * + * + * @author Jens Lehmann. + * + */ +public class ParserTest { + + @Test + public void KBParserTest() throws ParseException { + String test = "(\"Sentence\" AND (EXISTS \"syntaxTreeHasPart\".\"VVPP\" AND EXISTS \"syntaxTreeHasPart\".(\"stts:AuxilliaryVerb\" AND (\"hasLemma\" STRINGVALUE \"werden\"))))"; + Description d = KBParser.parseConcept(test); + System.out.println(d.toKBSyntaxString("http://localhost/foo#", null)); + Description d2 = KBParser.parseConcept(d.toKBSyntaxString()); + System.out.println(d2.toKBSyntaxString("http://localhost/foo#", null)); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |