From: <lor...@us...> - 2014-04-23 10:48:03
|
Revision: 4251 http://sourceforge.net/p/dl-learner/code/4251 Author: lorenz_b Date: 2014-04-23 10:47:59 +0000 (Wed, 23 Apr 2014) Log Message: ----------- Made config parser UTF-8 compatible. Modified Paths: -------------- trunk/interfaces/pom.xml trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserTokenManager.java trunk/interfaces/src/main/java/org/dllearner/confparser3/ParseException.java trunk/interfaces/src/main/java/org/dllearner/confparser3/SimpleCharStream.java trunk/interfaces/src/main/java/org/dllearner/confparser3/Token.java trunk/interfaces/src/main/java/org/dllearner/confparser3/TokenMgrError.java trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java Modified: trunk/interfaces/pom.xml =================================================================== --- trunk/interfaces/pom.xml 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/pom.xml 2014-04-23 10:47:59 UTC (rev 4251) @@ -402,6 +402,20 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>javacc-maven-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>javacc</id> + <goals> + <goal>javacc</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.mortbay.jetty</groupId> @@ -612,5 +626,14 @@ </dependency> </dependencies> +<reporting> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>javacc-maven-plugin</artifactId> + <version>2.6</version> + </plugin> + </plugins> + </reporting> </project> Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -25,6 +25,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -116,6 +117,7 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.SubClassAxiom; +import org.dllearner.kb.LocalModelBasedSparqlEndpointKS; import org.dllearner.kb.OWLAPIOntology; import org.dllearner.kb.SparqlEndpointKS; import org.dllearner.kb.sparql.ConciseBoundedDescriptionGenerator; @@ -214,6 +216,7 @@ private SecureRandom random = new SecureRandom(); // enrichment parameters + private SparqlEndpointKS ks; private SparqlEndpoint se; private Entity resource; private boolean verbose; @@ -316,8 +319,76 @@ learnedOWLAxioms = new HashSet<OWLAxiom>(); learnedEvaluatedAxioms = new HashSet<EvaluatedAxiom>(); + + // instantiate SPARQL endpoint wrapper component + ks = new SparqlEndpointKS(se); + try { + ks.init(); + ks.setSupportsSPARQL_1_1(!iterativeMode); + } catch (ComponentInitException e) { + e.printStackTrace(); + } + } + public Enrichment(SparqlEndpointKS ks, Entity resource, double threshold, int nrOfAxiomsToLearn, + boolean useInference, boolean verbose, int chunksize, + int maxExecutionTimeInSeconds, boolean omitExistingAxioms) { + this.ks = ks; + this.resource = resource; + this.verbose = verbose; + this.threshold = threshold; + this.nrOfAxiomsToLearn = nrOfAxiomsToLearn; + this.useInference = useInference; + this.chunksize = chunksize; + this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; + this.omitExistingAxioms = omitExistingAxioms; + + if(ks.isRemote()){ + try { + cacheDir = "cache" + File.separator + URLEncoder.encode(((SparqlEndpointKS)ks).getEndpoint().getURL().toString(), "UTF-8"); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + cache = new ExtractionDBCache(cacheDir); + } + + + objectPropertyAlgorithms = new LinkedList<Class<? extends AxiomLearningAlgorithm>>(); + objectPropertyAlgorithms.add(DisjointObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(EquivalentObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(FunctionalObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(InverseFunctionalObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(ObjectPropertyDomainAxiomLearner.class); + objectPropertyAlgorithms.add(ObjectPropertyRangeAxiomLearner.class); + objectPropertyAlgorithms.add(SubObjectPropertyOfAxiomLearner.class); + objectPropertyAlgorithms.add(SymmetricObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(AsymmetricObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(TransitiveObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(InverseObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(ReflexiveObjectPropertyAxiomLearner.class); + objectPropertyAlgorithms.add(IrreflexiveObjectPropertyAxiomLearner.class); + + dataPropertyAlgorithms = new LinkedList<Class<? extends AxiomLearningAlgorithm>>(); + dataPropertyAlgorithms.add(DisjointDataPropertyAxiomLearner.class); + dataPropertyAlgorithms.add(EquivalentDataPropertyAxiomLearner.class); + dataPropertyAlgorithms.add(FunctionalDataPropertyAxiomLearner.class); + dataPropertyAlgorithms.add(DataPropertyDomainAxiomLearner.class); + dataPropertyAlgorithms.add(DataPropertyRangeAxiomLearner.class); + dataPropertyAlgorithms.add(SubDataPropertyOfAxiomLearner.class); + + classAlgorithms = new LinkedList<Class<? extends LearningAlgorithm>>(); +// classAlgorithms.add(DisjointClassesLearner.class); +// classAlgorithms.add(SimpleSubclassLearner.class); + classAlgorithms.add(CELOE.class); + + algorithmRuns = new LinkedList<AlgorithmRun>(); + + learnedOWLAxioms = new HashSet<OWLAxiom>(); + learnedEvaluatedAxioms = new HashSet<EvaluatedAxiom>(); + } + public void setAllowedNamespaces(List<String> allowedNamespaces) { this.allowedNamespaces = allowedNamespaces; } @@ -331,11 +402,6 @@ public void start() throws ComponentInitException, IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, LearningProblemUnsupportedException, MalformedURLException { - // instantiate SPARQL endpoint wrapper component - SparqlEndpointKS ks = new SparqlEndpointKS(se); - ks.init(); - ks.setSupportsSPARQL_1_1(!iterativeMode); - // common helper objects SPARQLTasks st = new SPARQLTasks(se); @@ -344,7 +410,7 @@ // ks.setSupportsSPARQL_1_1(supportsSPARQL_1_1); if(useInference){ - reasoner = new SPARQLReasoner(ks, cache); + reasoner = new SPARQLReasoner(ks, cacheDir); System.out.print("Precomputing subsumption hierarchy ... "); long startTime = System.currentTimeMillis(); reasoner.prepareSubsumptionHierarchy(); @@ -459,6 +525,7 @@ } private void filterByNamespaces(Model model){ + List<Statement> toRemove = new ArrayList<>(); if(allowedNamespaces != null && !allowedNamespaces.isEmpty()){ for (StmtIterator iterator = model.listStatements(); iterator.hasNext();) { Statement st = iterator.next(); @@ -485,10 +552,11 @@ } } if(!startsWithAllowedNamespace){ - iterator.remove(); + toRemove.add(st); } } } + model.remove(toRemove); } @SuppressWarnings("unchecked") @@ -549,7 +617,13 @@ } else { System.out.print("extracting fragment ... ");//com.hp.hpl.jena.shared.impl.JenaParameters.enableEagerLiteralValidation = true; startTime = System.currentTimeMillis(); - Model model = getFragmentMultithreaded(ks, Sets.union(posExamples, negExamples)); + Model model; + if(ks.isRemote()){ + model = getFragmentMultithreaded(ks, Sets.union(posExamples, negExamples)); + } else { + model = ((LocalModelBasedSparqlEndpointKS)ks).getModel(); + } + filter(model); filterByNamespaces(model); OWLEntityTypeAdder.addEntityTypes(model); @@ -1136,6 +1210,7 @@ System.exit(0); } + SparqlEndpointKS ks = null; // create SPARQL endpoint object (check that indeed a URL was given) URL endpoint = null; try { @@ -1144,13 +1219,33 @@ System.out.println("The specified endpoint appears not be a proper URL."); System.exit(0); } - URI graph = null; + //check if the URL is a file and if exists load it into a JENA model try { - graph = (URI) options.valueOf("graph"); - } catch(OptionException e) { - System.out.println("The specified graph appears not be a proper URL."); - System.exit(0); + File file = new File(endpoint.toURI()); + if(file.exists()){ + Model kbModel = ModelFactory.createDefaultModel(); + kbModel.read(new FileInputStream(file), null); + ks = new LocalModelBasedSparqlEndpointKS(kbModel); + } else { + URI graph = null; + try { + graph = (URI) options.valueOf("graph"); + } catch(OptionException e) { + System.out.println("The specified graph appears not be a proper URL."); + System.exit(0); + } + + LinkedList<String> defaultGraphURIs = new LinkedList<String>(); + if(graph != null) { + defaultGraphURIs.add(graph.toString()); + } + SparqlEndpoint se = new SparqlEndpoint(endpoint, defaultGraphURIs, new LinkedList<String>()); + ks = new SparqlEndpointKS(se); + } + } catch (URISyntaxException e2) { + e2.printStackTrace(); } + URI resourceURI = null; try { resourceURI = (URI) options.valueOf("resource"); @@ -1170,30 +1265,25 @@ }); } - - LinkedList<String> defaultGraphURIs = new LinkedList<String>(); - if(graph != null) { - defaultGraphURIs.add(graph.toString()); - } - SparqlEndpoint se = new SparqlEndpoint(endpoint, defaultGraphURIs, new LinkedList<String>()); - - // sanity check that endpoint/graph returns at least one triple - String query = "SELECT * WHERE {?s ?p ?o} LIMIT 1"; - SparqlQuery sq = new SparqlQuery(query, se); - try { - ResultSet q = sq.send(); - while (q.hasNext()) { - q.next(); + if(ks.isRemote()){ + // sanity check that endpoint/graph returns at least one triple + String query = "SELECT * WHERE {?s ?p ?o} LIMIT 1"; + SparqlQuery sq = new SparqlQuery(query, ks.getEndpoint()); + try { + ResultSet q = sq.send(); + while (q.hasNext()) { + q.next(); + } + } catch(QueryExceptionHTTP e) { + System.out.println("Endpoint not reachable (check spelling)."); + System.exit(0); } - } catch(QueryExceptionHTTP e) { - System.out.println("Endpoint not reachable (check spelling)."); - System.exit(0); } // map resource to correct type Entity resource = null; if(options.valueOf("resource") != null) { - resource = new SPARQLTasks(se).guessResourceType(resourceURI.toString(), true); + resource = new SPARQLTasks(((SparqlEndpointKS)ks).getEndpoint()).guessResourceType(resourceURI.toString(), true); if(resource == null) { throw new IllegalArgumentException("Could not determine the type (class, object property or data property) of input resource " + options.valueOf("resource")); } @@ -1229,7 +1319,7 @@ boolean processDataProperties = (Boolean) options.valueOf("dp"); boolean processClasses = (Boolean) options.valueOf("cls"); - Enrichment e = new Enrichment(se, resource, threshold, maxNrOfResults, useInference, false, chunksize, maxExecutionTimeInSeconds, omitExistingAxioms); + Enrichment e = new Enrichment(ks, resource, threshold, maxNrOfResults, useInference, false, chunksize, maxExecutionTimeInSeconds, omitExistingAxioms); e.setAllowedNamespaces(allowedNamespaces); e.setIterativeMode(iterativeMode); e.setProcessObjectProperties(processObjectProperties); @@ -1237,8 +1327,6 @@ e.setProcessClasses(processClasses); e.start(); - SparqlEndpointKS ks = new SparqlEndpointKS(se); - // print output in correct format if(options.has("f")) { List<AlgorithmRun> runs = e.getAlgorithmRuns(); Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -1,3 +1,4 @@ +/* ConfParser.java */ /* Generated By:JavaCC: Do not edit this line. ConfParser.java */ package org.dllearner.confparser3; @@ -4,6 +5,8 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -13,7 +16,6 @@ import org.dllearner.cli.ConfFileOption2; import org.dllearner.parser.KBParser; -import org.dllearner.utilities.datastructures.StringTuple; public class ConfParser implements ConfParserConstants { @@ -58,38 +60,37 @@ return confOptionsByBean.get(beanName); } - public static ConfParser parseFile(File filename) throws FileNotFoundException, ParseException { - ConfParser parser = new ConfParser(new FileInputStream(filename)); + public static ConfParser parseFile(File filename) throws FileNotFoundException, ParseException, UnsupportedEncodingException { + ConfParser parser = new ConfParser(new InputStreamReader(new FileInputStream(filename),"UTF-8")); parser.Start(); return parser; } - final public void Start() throws ParseException { - ConfFileOption2 confOption; + final public void Start() throws ParseException {ConfFileOption2 confOption; label_1: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ID:{ ; break; + } default: jj_la1[0] = jj_gen; break label_1; } confOption = ConfOption(); - if(confOption.getPropertyName() == null) { +if(confOption.getPropertyName() == null) { specialOptions.put(confOption.getBeanName(),confOption); } else { addConfOption(confOption); } } jj_consume_token(0); - PostProcessor pp = new PostProcessor(confOptions, specialOptions); +PostProcessor pp = new PostProcessor(confOptions, specialOptions); pp.applyAll(); } - final public ConfFileOption2 ConfOption() throws ParseException { - boolean containsSubOption=false; + final public ConfFileOption2 ConfOption() throws ParseException {boolean containsSubOption=false; String value="", value1="", value2="", tmp="", tmp2=""; Set<String> values = new HashSet<String>(); Map<String,String> tuples = new HashMap<String,String>(); @@ -105,47 +106,52 @@ Object val = null; Double d; beanName = Id(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMAND_END: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMAND_END:{ jj_consume_token(COMMAND_END); propertyName = Id(); - containsSubOption=true; +containsSubOption=true; break; + } default: jj_la1[1] = jj_gen; ; } jj_consume_token(13); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ID:{ // two strings separated by a double colon // LOOKAHEAD(2) value1=Id() ":" value2=Id() { useColon = true; } // simple string propertyValue = Id(); - if(propertyValue.equals("true") || propertyValue.equals("false")) { +if(propertyValue.equals("true") || propertyValue.equals("false")) { val = Boolean.valueOf(propertyValue); propertyType = Boolean.class; } else { val = propertyValue; propertyType = String.class; isBeanRef = true; } break; - case STRING: + } + case STRING:{ propertyValue = String(); - val = propertyValue; propertyType = String.class; +val = propertyValue; propertyType = String.class; break; - case NUMBER: + } + case NUMBER:{ val = Integer(); - propertyValue = val.toString(); propertyType = Integer.class; +propertyValue = val.toString(); propertyType = Integer.class; break; - case DOUBLE: + } + case DOUBLE:{ val = Double(); - propertyValue = val.toString(); propertyType = Double.class; +propertyValue = val.toString(); propertyType = Double.class; break; + } default: jj_la1[2] = jj_gen; if (jj_2_5(2147483647)) { jj_consume_token(14); jj_consume_token(15); - val = new HashSet(); propertyType = Set.class; propertyValue = "{}"; +val = new HashSet(); propertyType = Set.class; propertyValue = "{}"; } else if (jj_2_6(4)) { jj_consume_token(14); label_2: @@ -156,20 +162,21 @@ break label_2; } tmp = String(); - values.add(tmp); propertyValue += "\u005c"" + tmp + "\u005c", "; +values.add(tmp); propertyValue += "\u005c"" + tmp + "\u005c", "; jj_consume_token(16); } tmp = String(); - values.add(tmp); propertyValue += "\u005c"" + tmp + "\u005c""; +values.add(tmp); propertyValue += "\u005c"" + tmp + "\u005c""; jj_consume_token(15); - propertyType = Set.class; propertyValue = "{"+ propertyValue + "}";; val = values; +propertyType = Set.class; propertyValue = "{"+ propertyValue + "}";; val = values; } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 17: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case 17:{ jj_consume_token(17); - val = new HashSet(); propertyType = Set.class; propertyValue = "-"; isBeanCollection = true; +val = new HashSet(); propertyType = Set.class; propertyValue = "-"; isBeanCollection = true; break; - case 14: + } + case 14:{ jj_consume_token(14); label_3: while (true) { @@ -179,20 +186,21 @@ break label_3; } tmp = Id(); - values.add(tmp); propertyValue += tmp + ", "; +values.add(tmp); propertyValue += tmp + ", "; jj_consume_token(16); } tmp = Id(); - values.add(tmp); propertyValue += tmp; +values.add(tmp); propertyValue += tmp; jj_consume_token(15); - val = values; propertyType = Set.class; propertyValue = "{"+ propertyValue + "}"; isBeanCollection = true; +val = values; propertyType = Set.class; propertyValue = "{"+ propertyValue + "}"; isBeanCollection = true; break; + } default: jj_la1[3] = jj_gen; if (jj_2_7(2147483647)) { jj_consume_token(18); jj_consume_token(19); - val = new LinkedList(); propertyType = List.class; propertyValue = "[]"; +val = new LinkedList(); propertyType = List.class; propertyValue = "[]"; } else if (jj_2_8(2147483647)) { jj_consume_token(18); label_4: @@ -207,7 +215,7 @@ jj_consume_token(16); tmp2 = String(); jj_consume_token(21); - tuples.put(tmp,tmp2); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c"), "; +tuples.put(tmp,tmp2); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c"), "; jj_consume_token(16); } jj_consume_token(20); @@ -215,12 +223,12 @@ jj_consume_token(16); tmp2 = String(); jj_consume_token(21); - tuples.put(tmp,tmp2); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c")"; +tuples.put(tmp,tmp2); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c")"; jj_consume_token(19); - val = tuples; propertyType = List.class; propertyValue = "["+ propertyValue + "]"; +val = tuples; propertyType = List.class; propertyValue = "["+ propertyValue + "]"; } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 18: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case 18:{ jj_consume_token(18); label_5: while (true) { @@ -234,7 +242,7 @@ jj_consume_token(16); d = Double(); jj_consume_token(21); - tuplesD.put(tmp,d); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + d.toString() + "\u005c"), "; +tuplesD.put(tmp,d); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + d.toString() + "\u005c"), "; jj_consume_token(16); } jj_consume_token(20); @@ -242,10 +250,11 @@ jj_consume_token(16); d = Double(); jj_consume_token(21); - tuplesD.put(tmp,d); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + d.toString() + "\u005c")"; +tuplesD.put(tmp,d); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + d.toString() + "\u005c")"; jj_consume_token(19); - val = tuplesD; propertyType = List.class; propertyValue = "["+ propertyValue + "]"; +val = tuplesD; propertyType = List.class; propertyValue = "["+ propertyValue + "]"; break; + } default: jj_la1[4] = jj_gen; jj_consume_token(-1); @@ -255,7 +264,7 @@ } } } - option.setBeanRef(isBeanRef); +option.setBeanRef(isBeanRef); option.setBeanReferenceCollection(isBeanCollection); option.setBeanName(beanName); if(containsSubOption) { @@ -264,41 +273,42 @@ option.setPropertyType(propertyType); option.setPropertyValue(propertyValue); option.setValueObject(val); - {if (true) return option;} + {if ("" != null) return option;} throw new Error("Missing return statement in function"); } - final public String Individual() throws ParseException { - String name; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: + final public String Individual() throws ParseException {String name; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ID:{ name = Id(); break; - case STRING: + } + case STRING:{ name = String(); break; + } default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return KBParser.getInternalURI(name);} +{if ("" != null) return KBParser.getInternalURI(name);} throw new Error("Missing return statement in function"); } - final public String ComplexId() throws ParseException { - Token t1,t2; + final public String ComplexId() throws ParseException {Token t1,t2; if (jj_2_9(2)) { t1 = jj_consume_token(ID); jj_consume_token(22); t2 = jj_consume_token(ID); - {if (true) return t1.image + ":" + t2.image;} +{if ("" != null) return t1.image + ":" + t2.image;} } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ID:{ t1 = jj_consume_token(ID); - {if (true) return t1.image;} +{if ("" != null) return t1.image;} break; + } default: jj_la1[6] = jj_gen; jj_consume_token(-1); @@ -308,102 +318,108 @@ throw new Error("Missing return statement in function"); } - final public String Id() throws ParseException { - Token t; + final public String Id() throws ParseException {Token t; t = jj_consume_token(ID); - {if (true) return t.image;} +{if ("" != null) return t.image;} throw new Error("Missing return statement in function"); } - final public Double Double() throws ParseException { - Token t; + final public Double Double() throws ParseException {Token t; t = jj_consume_token(DOUBLE); - {if (true) return new Double(t.image);} +{if ("" != null) return new Double(t.image);} throw new Error("Missing return statement in function"); } - final public Integer Integer() throws ParseException { - Token t; + final public Integer Integer() throws ParseException {Token t; t = jj_consume_token(NUMBER); - {if (true) return new Integer(t.image);} +{if ("" != null) return new Integer(t.image);} throw new Error("Missing return statement in function"); } - final public String String() throws ParseException { - Token t; + final public String String() throws ParseException {Token t; String s; t = jj_consume_token(STRING); - // enclosing "" are removed +// enclosing "" are removed s = t.image; s = s.substring(1, s.length() - 1); - {if (true) return s;} + {if ("" != null) return s;} throw new Error("Missing return statement in function"); } - private boolean jj_2_1(int xla) { + private boolean jj_2_1(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } - private boolean jj_2_2(int xla) { + private boolean jj_2_2(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } - private boolean jj_2_3(int xla) { + private boolean jj_2_3(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } - private boolean jj_2_4(int xla) { + private boolean jj_2_4(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } - private boolean jj_2_5(int xla) { + private boolean jj_2_5(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } - private boolean jj_2_6(int xla) { + private boolean jj_2_6(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_6(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(5, xla); } } - private boolean jj_2_7(int xla) { + private boolean jj_2_7(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_7(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(6, xla); } } - private boolean jj_2_8(int xla) { + private boolean jj_2_8(int xla) + { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_8(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(7, xla); } } - private boolean jj_2_9(int 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_3() { + private boolean jj_3_3() + { if (jj_scan_token(20)) return true; if (jj_3R_6()) return true; if (jj_scan_token(16)) return true; @@ -413,40 +429,47 @@ return false; } - private boolean jj_3R_7() { + private boolean jj_3R_7() + { if (jj_scan_token(ID)) return true; return false; } - private boolean jj_3_2() { + private boolean jj_3_2() + { if (jj_3R_7()) return true; if (jj_scan_token(16)) return true; return false; } - private boolean jj_3_5() { + private boolean jj_3_5() + { if (jj_scan_token(14)) return true; if (jj_scan_token(15)) return true; return false; } - private boolean jj_3_9() { + private boolean jj_3_9() + { if (jj_scan_token(ID)) return true; if (jj_scan_token(22)) return true; return false; } - private boolean jj_3R_8() { + private boolean jj_3R_8() + { if (jj_scan_token(DOUBLE)) return true; return false; } - private boolean jj_3R_6() { + private boolean jj_3R_6() + { if (jj_scan_token(STRING)) return true; return false; } - private boolean jj_3_4() { + private boolean jj_3_4() + { if (jj_scan_token(20)) return true; if (jj_3R_6()) return true; if (jj_scan_token(16)) return true; @@ -456,7 +479,8 @@ return false; } - private boolean jj_3_8() { + private boolean jj_3_8() + { if (jj_scan_token(18)) return true; if (jj_scan_token(20)) return true; if (jj_3R_6()) return true; @@ -465,7 +489,8 @@ return false; } - private boolean jj_3_6() { + private boolean jj_3_6() + { if (jj_scan_token(14)) return true; Token xsp; while (true) { @@ -477,13 +502,15 @@ return false; } - private boolean jj_3_1() { + private boolean jj_3_1() + { if (jj_3R_6()) return true; if (jj_scan_token(16)) return true; return false; } - private boolean jj_3_7() { + private boolean jj_3_7() + { if (jj_scan_token(18)) return true; if (jj_scan_token(19)) return true; return false; @@ -608,6 +635,7 @@ throw generateParseException(); } + @SuppressWarnings("serial") static private final class LookaheadSuccess extends java.lang.Error { } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); private boolean jj_scan_token(int kind) { @@ -651,7 +679,7 @@ return t; } - private int jj_ntk() { + private int jj_ntk_f() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserTokenManager.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserTokenManager.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserTokenManager.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -1,3 +1,4 @@ +/* ConfParserTokenManager.java */ /* Generated By:JavaCC: Do not edit this line. ConfParserTokenManager.java */ package org.dllearner.confparser3; import java.io.File; @@ -14,23 +15,20 @@ import org.dllearner.utilities.datastructures.StringTuple; /** Token Manager. */ -public class ConfParserTokenManager implements ConfParserConstants -{ +@SuppressWarnings("unused")public class ConfParserTokenManager implements ConfParserConstants { /** Debug output. */ public java.io.PrintStream debugStream = System.out; /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } -private final int jjStopStringLiteralDfa_0(int pos, long active0) -{ +private final int jjStopStringLiteralDfa_0(int pos, long active0){ switch (pos) { default : return -1; } } -private final int jjStartNfa_0(int pos, long active0) -{ +private final int jjStartNfa_0(int pos, long active0){ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } private int jjStopAtPos(int pos, int kind) @@ -39,8 +37,7 @@ jjmatchedPos = pos; return pos + 1; } -private int jjMoveStringLiteralDfa0_0() -{ +private int jjMoveStringLiteralDfa0_0(){ switch(curChar) { case 40: @@ -70,6 +67,9 @@ } } static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private int jjMoveNfa_0(int startState, int curPos) @@ -95,18 +95,18 @@ { if (kind > 10) kind = 10; - jjCheckNAddStates(0, 2); + { jjCheckNAddStates(0, 2); } } else if (curChar == 48) { if (kind > 10) kind = 10; - jjCheckNAdd(27); + { jjCheckNAdd(27); } } else if (curChar == 47) - jjAddStates(3, 5); + { jjAddStates(3, 5); } else if (curChar == 34) - jjCheckNAddTwoStates(3, 4); + { jjCheckNAddTwoStates(3, 4); } break; case 1: if ((0x3ff000000000000L & l) == 0L) @@ -117,11 +117,11 @@ break; case 2: if (curChar == 34) - jjCheckNAddTwoStates(3, 4); + { jjCheckNAddTwoStates(3, 4); } break; case 3: if ((0xfffffffbffffffffL & l) != 0L) - jjCheckNAddTwoStates(3, 4); + { jjCheckNAddTwoStates(3, 4); } break; case 4: if (curChar == 34 && kind > 12) @@ -129,15 +129,15 @@ break; case 5: if (curChar == 47) - jjAddStates(3, 5); + { jjAddStates(3, 5); } break; case 6: if (curChar == 47) - jjCheckNAddStates(6, 8); + { jjCheckNAddStates(6, 8); } break; case 7: if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(6, 8); + { jjCheckNAddStates(6, 8); } break; case 8: if ((0x2400L & l) != 0L && kind > 5) @@ -153,23 +153,23 @@ break; case 11: if (curChar == 42) - jjCheckNAddTwoStates(12, 13); + { jjCheckNAddTwoStates(12, 13); } break; case 12: if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(12, 13); + { jjCheckNAddTwoStates(12, 13); } break; case 13: if (curChar == 42) - jjCheckNAddStates(9, 11); + { jjCheckNAddStates(9, 11); } break; case 14: if ((0xffff7bffffffffffL & l) != 0L) - jjCheckNAddTwoStates(15, 13); + { jjCheckNAddTwoStates(15, 13); } break; case 15: if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(15, 13); + { jjCheckNAddTwoStates(15, 13); } break; case 16: if (curChar == 47 && kind > 6) @@ -181,23 +181,23 @@ break; case 18: if (curChar == 42) - jjCheckNAddTwoStates(19, 20); + { jjCheckNAddTwoStates(19, 20); } break; case 19: if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(19, 20); + { jjCheckNAddTwoStates(19, 20); } break; case 20: if (curChar == 42) - jjCheckNAddStates(12, 14); + { jjCheckNAddStates(12, 14); } break; case 21: if ((0xffff7bffffffffffL & l) != 0L) - jjCheckNAddTwoStates(22, 20); + { jjCheckNAddTwoStates(22, 20); } break; case 22: if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(22, 20); + { jjCheckNAddTwoStates(22, 20); } break; case 23: if (curChar == 47 && kind > 7) @@ -208,39 +208,39 @@ break; if (kind > 10) kind = 10; - jjCheckNAddStates(0, 2); + { jjCheckNAddStates(0, 2); } break; case 25: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 10) kind = 10; - jjCheckNAdd(25); + { jjCheckNAdd(25); } break; case 26: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(26, 27); + { jjCheckNAddTwoStates(26, 27); } break; case 27: if (curChar != 46) break; if (kind > 11) kind = 11; - jjCheckNAdd(28); + { jjCheckNAdd(28); } break; case 28: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 11) kind = 11; - jjCheckNAdd(28); + { jjCheckNAdd(28); } break; case 29: if (curChar != 48) break; if (kind > 10) kind = 10; - jjCheckNAdd(27); + { jjCheckNAdd(27); } break; default : break; } @@ -258,35 +258,35 @@ break; if (kind > 9) kind = 9; - jjCheckNAdd(1); + { jjCheckNAdd(1); } break; case 1: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 9) kind = 9; - jjCheckNAdd(1); + { jjCheckNAdd(1); } break; case 3: if ((0xffffffffefffffffL & l) != 0L) - jjAddStates(15, 16); + { jjAddStates(15, 16); } break; case 7: - jjAddStates(6, 8); + { jjAddStates(6, 8); } break; case 12: - jjCheckNAddTwoStates(12, 13); + { jjCheckNAddTwoStates(12, 13); } break; case 14: case 15: - jjCheckNAddTwoStates(15, 13); + { jjCheckNAddTwoStates(15, 13); } break; case 19: - jjCheckNAddTwoStates(19, 20); + { jjCheckNAddTwoStates(19, 20); } break; case 21: case 22: - jjCheckNAddTwoStates(22, 20); + { jjCheckNAddTwoStates(22, 20); } break; default : break; } @@ -294,6 +294,9 @@ } else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do @@ -301,32 +304,32 @@ switch(jjstateSet[--i]) { case 3: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(15, 16); + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + { jjAddStates(15, 16); } break; case 7: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(6, 8); + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + { jjAddStates(6, 8); } break; case 12: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(12, 13); + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + { jjCheckNAddTwoStates(12, 13); } break; case 14: case 15: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(15, 13); + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + { jjCheckNAddTwoStates(15, 13); } break; case 19: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(19, 20); + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + { jjCheckNAddTwoStates(19, 20); } break; case 21: case 22: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(22, 20); + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + { jjCheckNAddTwoStates(22, 20); } break; - default : break; + default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; } } while(i != startsAt); } @@ -347,71 +350,23 @@ 25, 26, 27, 6, 17, 18, 7, 8, 10, 13, 14, 16, 20, 21, 23, 3, 4, }; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, "\56", null, null, null, null, "\75", "\173", "\175", "\54", "\55", "\133", "\135", "\50", "\51", "\72", }; - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", -}; -static final long[] jjtoToken = { - 0x7fff01L, -}; -static final long[] jjtoSkip = { - 0xfeL, -}; -protected SimpleCharStream input_stream; -private final int[] jjrounds = new int[30]; -private final int[] jjstateSet = new int[60]; -protected char curChar; -/** Constructor. */ -public ConfParserTokenManager(SimpleCharStream stream){ - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; -} - -/** Constructor. */ -public ConfParserTokenManager(SimpleCharStream stream, int lexState){ - this(stream); - SwitchTo(lexState); -} - -/** Reinitialise parser. */ -public void ReInit(SimpleCharStream stream) -{ - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); -} -private void ReInitRounds() -{ - int i; - jjround = 0x80000001; - for (i = 30; i-- > 0;) - jjrounds[i] = 0x80000000; -} - -/** Reinitialise parser. */ -public void ReInit(SimpleCharStream stream, int lexState) -{ - ReInit(stream); - SwitchTo(lexState); -} - -/** Switch to specified lex state. */ -public void SwitchTo(int lexState) -{ - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; -} - protected Token jjFillToken() { final Token t; @@ -459,6 +414,7 @@ catch(java.io.IOException e) { jjmatchedKind = 0; + jjmatchedPos = -1; matchedToken = jjFillToken(); return matchedToken; } @@ -535,4 +491,69 @@ } while (start++ != end); } + /** Constructor. */ + public ConfParserTokenManager(SimpleCharStream stream){ + + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + + input_stream = stream; + } + + /** Constructor. */ + public ConfParserTokenManager (SimpleCharStream stream, int lexState){ + ReInit(stream); + SwitchTo(lexState); + } + + /** Reinitialise parser. */ + public void ReInit(SimpleCharStream stream) + { + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); + } + + private void ReInitRounds() + { + int i; + jjround = 0x80000001; + for (i = 30; i-- > 0;) + jjrounds[i] = 0x80000000; + } + + /** Reinitialise parser. */ + public void ReInit(SimpleCharStream stream, int lexState) + { + ReInit(stream); + SwitchTo(lexState); + } + + /** Switch to specified lex state. */ + public void SwitchTo(int lexState) + { + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; + } + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0x7fff01L, +}; +static final long[] jjtoSkip = { + 0xfeL, +}; + protected SimpleCharStream input_stream; + + private final int[] jjrounds = new int[30]; + private final int[] jjstateSet = new int[2 * 30]; + + + protected char curChar; } Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/ParseException.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/ParseException.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/ParseException.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 6.0 */ /* JavaCCOptions:KEEP_LINE_COL=null */ package org.dllearner.confparser3; @@ -184,4 +184,4 @@ } } -/* JavaCC - OriginalChecksum=44a252ba2c41282348d0b2fcf86420df (do not edit this line) */ +/* JavaCC - OriginalChecksum=72d8badf88dbc09bae77f8c82b715143 (do not edit this line) */ Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/SimpleCharStream.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/SimpleCharStream.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/SimpleCharStream.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 6.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.dllearner.confparser3; @@ -31,9 +31,10 @@ protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; + protected boolean trackLineColumn = true; - protected void setTabSize(int i) { tabSize = i; } - protected int getTabSize(int i) { return tabSize; } + public void setTabSize(int i) { tabSize = i; } + public int getTabSize() { return tabSize; } protected void ExpandBuff(boolean wrapAround) @@ -467,5 +468,7 @@ column = bufcolumn[j]; } + boolean getTrackLineColumn() { return trackLineColumn; } + void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } } -/* JavaCC - OriginalChecksum=9533267d690297b19b8deefd4143bb73 (do not edit this line) */ +/* JavaCC - OriginalChecksum=e6b5e4f4223db89b882e22f7e6893bd9 (do not edit this line) */ Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/Token.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/Token.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/Token.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 6.0 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.dllearner.confparser3; @@ -128,4 +128,4 @@ } } -/* JavaCC - OriginalChecksum=f5f1c260daaacf6ad7943faea399abd0 (do not edit this line) */ +/* JavaCC - OriginalChecksum=b46f40b47c1ab727d843a023759aeb18 (do not edit this line) */ Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/TokenMgrError.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/TokenMgrError.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/TokenMgrError.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 6.0 */ /* JavaCCOptions: */ package org.dllearner.confparser3; @@ -144,4 +144,4 @@ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } -/* JavaCC - OriginalChecksum=cfdfdc87d92964d81aa3da705fa4b09a (do not edit this line) */ +/* JavaCC - OriginalChecksum=52462882bed940bf33866ca9696c8f85 (do not edit this line) */ Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj 2014-04-23 10:47:59 UTC (rev 4251) @@ -26,6 +26,7 @@ options { JDK_VERSION = "1.6"; STATIC = false; + UNICODE_INPUT=true; } PARSER_BEGIN(ConfParser) @@ -33,7 +34,9 @@ import java.io.File; import java.io.FileInputStream; +import java.io.InputStreamReader; import java.io.FileNotFoundException; +import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -88,8 +91,8 @@ return confOptionsByBean.get(beanName); } - public static ConfParser parseFile(File filename) throws FileNotFoundException, ParseException { - ConfParser parser = new ConfParser(new FileInputStream(filename)); + public static ConfParser parseFile(File filename) throws FileNotFoundException, ParseException, UnsupportedEncodingException { + ConfParser parser = new ConfParser(new InputStreamReader(new FileInputStream(filename),"UTF-8")); parser.Start(); return parser; } Modified: trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java 2014-03-21 19:21:47 UTC (rev 4250) +++ trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java 2014-04-23 10:47:59 UTC (rev 4251) @@ -21,6 +21,7 @@ import java.io.File; import java.io.FileNotFoundException; +import java.io.UnsupportedEncodingException; import org.dllearner.cli.ConfFileOption2; import org.junit.Test; @@ -34,7 +35,7 @@ public class ParseTest { @Test - public void test() throws FileNotFoundException, ParseException { + public void test() throws FileNotFoundException, ParseException, UnsupportedEncodingException { ConfParser parser = ConfParser.parseFile(new File("../examples/family/father.conf")); for(ConfFileOption2 option : parser.getConfOptions()) { System.out.print(option.getBeanName() + "." + option.getPropertyName() + " = " + option.getValue().toString()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |