You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by afs <gi...@git.apache.org> on 2018/08/05 11:42:04 UTC

[GitHub] jena pull request #455: JENA-1584: A Javacc Turtle parser for reference.

GitHub user afs opened a pull request:

    https://github.com/apache/jena/pull/455

    JENA-1584: A Javacc Turtle parser for reference.

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afs/jena ttl-javacc

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/455.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #455
    
----
commit 7fb8a91d0f799161c5694ef64c344bd41b7b7cc8
Author: Andy Seaborne <an...@...>
Date:   2018-07-31T11:05:07Z

    JENA-1584: A Javacc Turtle parser for reference.

----


---

[GitHub] jena pull request #455: JENA-1584: A Javacc Turtle parser for reference.

Posted by kinow <gi...@git.apache.org>.
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/jena/pull/455#discussion_r207735233
  
    --- Diff: jena-arq/src/main/java/org/apache/jena/riot/lang/extra/javacc/ParseException.java ---
    @@ -0,0 +1,205 @@
    +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 6.0 */
    +/* JavaCCOptions:KEEP_LINE_COL=null */
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.jena.riot.lang.extra.javacc;
    +
    +/**
    + * This exception is thrown when parse errors are encountered.
    + * You can explicitly create objects of this exception type by
    + * calling the method generateParseException in the generated
    + * parser.
    + *
    + * You can modify this class to customize your error reporting
    + * mechanisms so long as you retain the public fields.
    + */
    +public class ParseException extends Exception {
    +
    +  /**
    +   * The version identifier for this Serializable class.
    +   * Increment only if the <i>serialized</i> form of the
    +   * class changes.
    +   */
    +  private static final long serialVersionUID = 1L;
    +
    +  /**
    +   * This constructor is used by the method "generateParseException"
    +   * in the generated parser.  Calling this constructor generates
    +   * a new object of this type with the fields "currentToken",
    +   * "expectedTokenSequences", and "tokenImage" set.
    +   */
    +  public ParseException(Token currentTokenVal,
    +                        int[][] expectedTokenSequencesVal,
    +                        String[] tokenImageVal
    +                       )
    +  {
    +    super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
    +    currentToken = currentTokenVal;
    +    expectedTokenSequences = expectedTokenSequencesVal;
    +    tokenImage = tokenImageVal;
    +  }
    +
    +  /**
    +   * The following constructors are for use by you for whatever
    +   * purpose you can think of.  Constructing the exception in this
    +   * manner makes the exception behave in the normal way - i.e., as
    +   * documented in the class "Throwable".  The fields "errorToken",
    +   * "expectedTokenSequences", and "tokenImage" do not contain
    +   * relevant information.  The JavaCC generated code does not use
    +   * these constructors.
    +   */
    +
    +  public ParseException() {
    +    super();
    +  }
    +
    +  /** Constructor with message. */
    +  public ParseException(String message) {
    +    super(message);
    +  }
    +
    +
    +  /**
    +   * This is the last token that has been consumed successfully.  If
    +   * this object has been created due to a parse error, the token
    +   * followng this token will (therefore) be the first error token.
    +   */
    +  public Token currentToken;
    +
    +  /**
    +   * Each entry in this array is an array of integers.  Each array
    +   * of integers represents a sequence of tokens (by their ordinal
    +   * values) that is expected at this point of the parse.
    +   */
    +  public int[][] expectedTokenSequences;
    +
    +  /**
    +   * This is a reference to the "tokenImage" array of the generated
    +   * parser within which the parse error occurred.  This array is
    +   * defined in the generated ...Constants interface.
    +   */
    +  public String[] tokenImage;
    +
    +  /**
    +   * It uses "currentToken" and "expectedTokenSequences" to generate a parse
    +   * error message and returns it.  If this object has been created
    +   * due to a parse error, and you do not catch it (it gets thrown
    +   * from the parser) the correct error message
    +   * gets displayed.
    +   */
    +  private static String initialise(Token currentToken,
    +                           int[][] expectedTokenSequences,
    +                           String[] tokenImage) {
    +    String eol = System.getProperty("line.separator", "\n");
    +    StringBuffer expected = new StringBuffer();
    +    int maxSize = 0;
    +    for (int i = 0; i < expectedTokenSequences.length; i++) {
    +      if (maxSize < expectedTokenSequences[i].length) {
    +        maxSize = expectedTokenSequences[i].length;
    +      }
    +      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
    +        expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
    +      }
    +      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
    +        expected.append("...");
    +      }
    +      expected.append(eol).append("    ");
    +    }
    +    String retval = "Encountered \"";
    +    Token tok = currentToken.next;
    +    for (int i = 0; i < maxSize; i++) {
    +      if (i != 0) retval += " ";
    +      if (tok.kind == 0) {
    +        retval += tokenImage[0];
    +        break;
    +      }
    +      retval += " " + tokenImage[tok.kind];
    +      retval += " \"";
    +      retval += add_escapes(tok.image);
    +      retval += " \"";
    +      tok = tok.next;
    +    }
    +    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
    +    retval += "." + eol;
    +    if (expectedTokenSequences.length == 1) {
    +      retval += "Was expecting:" + eol + "    ";
    +    } else {
    +      retval += "Was expecting one of:" + eol + "    ";
    +    }
    +    retval += expected.toString();
    +    return retval;
    +  }
    +
    +  /**
    +   * The end of line string for this machine.
    +   */
    +  protected String eol = System.getProperty("line.separator", "\n");
    +
    +  /**
    +   * Used to convert raw characters to their escaped version
    +   * when these raw version cannot be used as part of an ASCII
    +   * string literal.
    +   */
    +  static String add_escapes(String str) {
    +      StringBuffer retval = new StringBuffer();
    --- End diff --
    
    See comment above about `StringBuffer` & `StringBuilder`...


---

[GitHub] jena pull request #455: JENA-1584: A Javacc Turtle parser for reference.

Posted by kinow <gi...@git.apache.org>.
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/jena/pull/455#discussion_r207735228
  
    --- Diff: jena-arq/src/main/java/org/apache/jena/riot/lang/extra/javacc/ParseException.java ---
    @@ -0,0 +1,205 @@
    +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 6.0 */
    +/* JavaCCOptions:KEEP_LINE_COL=null */
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.jena.riot.lang.extra.javacc;
    +
    +/**
    + * This exception is thrown when parse errors are encountered.
    + * You can explicitly create objects of this exception type by
    + * calling the method generateParseException in the generated
    + * parser.
    + *
    + * You can modify this class to customize your error reporting
    + * mechanisms so long as you retain the public fields.
    + */
    +public class ParseException extends Exception {
    +
    +  /**
    +   * The version identifier for this Serializable class.
    +   * Increment only if the <i>serialized</i> form of the
    +   * class changes.
    +   */
    +  private static final long serialVersionUID = 1L;
    +
    +  /**
    +   * This constructor is used by the method "generateParseException"
    +   * in the generated parser.  Calling this constructor generates
    +   * a new object of this type with the fields "currentToken",
    +   * "expectedTokenSequences", and "tokenImage" set.
    +   */
    +  public ParseException(Token currentTokenVal,
    +                        int[][] expectedTokenSequencesVal,
    +                        String[] tokenImageVal
    +                       )
    +  {
    +    super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
    +    currentToken = currentTokenVal;
    +    expectedTokenSequences = expectedTokenSequencesVal;
    +    tokenImage = tokenImageVal;
    +  }
    +
    +  /**
    +   * The following constructors are for use by you for whatever
    +   * purpose you can think of.  Constructing the exception in this
    +   * manner makes the exception behave in the normal way - i.e., as
    +   * documented in the class "Throwable".  The fields "errorToken",
    +   * "expectedTokenSequences", and "tokenImage" do not contain
    +   * relevant information.  The JavaCC generated code does not use
    +   * these constructors.
    +   */
    +
    +  public ParseException() {
    +    super();
    +  }
    +
    +  /** Constructor with message. */
    +  public ParseException(String message) {
    +    super(message);
    +  }
    +
    +
    +  /**
    +   * This is the last token that has been consumed successfully.  If
    +   * this object has been created due to a parse error, the token
    +   * followng this token will (therefore) be the first error token.
    +   */
    +  public Token currentToken;
    +
    +  /**
    +   * Each entry in this array is an array of integers.  Each array
    +   * of integers represents a sequence of tokens (by their ordinal
    +   * values) that is expected at this point of the parse.
    +   */
    +  public int[][] expectedTokenSequences;
    +
    +  /**
    +   * This is a reference to the "tokenImage" array of the generated
    +   * parser within which the parse error occurred.  This array is
    +   * defined in the generated ...Constants interface.
    +   */
    +  public String[] tokenImage;
    +
    +  /**
    +   * It uses "currentToken" and "expectedTokenSequences" to generate a parse
    +   * error message and returns it.  If this object has been created
    +   * due to a parse error, and you do not catch it (it gets thrown
    +   * from the parser) the correct error message
    +   * gets displayed.
    +   */
    +  private static String initialise(Token currentToken,
    +                           int[][] expectedTokenSequences,
    +                           String[] tokenImage) {
    +    String eol = System.getProperty("line.separator", "\n");
    +    StringBuffer expected = new StringBuffer();
    --- End diff --
    
    Not that it makes much difference, but I think this one is still synchronized, so probably safer to use `StringBuilder`? Not sure if that changed in recent releases of the JVM though... nor if that really matters much...


---

[GitHub] jena issue #455: JENA-1584: A Javacc Turtle parser for reference.

Posted by kinow <gi...@git.apache.org>.
Github user kinow commented on the issue:

    https://github.com/apache/jena/pull/455
  
    Tested just the new parser with with the following code:
    
    ```java
        public static void main(String args[]) {
            try {
                java.io.Reader in = new java.io.StringReader(FileUtils.readFileToString(new File("/home/kinow/Development/php/workspace/Skosmos/config.ttl"), Charset.forName("UTF-8"))) ;
                TurtleJavacc parser = new TurtleJavacc(in) ;
    
                FactoryRDF factory = new FactoryRDFStd();
                ErrorHandler errorHandler = ErrorHandlerFactory.errorHandlerSimple();
                IRIResolver resolver = IRIResolver.create();
                PrefixMap prefixMap = new PrefixMapStd();
                Context context = null;
                boolean checking = true ;
                boolean strictMode = true;
                ParserProfile profile = new ParserProfileStd(factory, errorHandler, resolver, prefixMap, context, checking, strictMode);
                StreamRDF dest = new PrintingStreamRDF(System.out);
                parser.setDest(dest);
                parser.setProfile(profile);
                
                dest.start();
                parser.parse();
                dest.finish();
                
                System.out.println("Parsed query successfully!") ;
                System.out.println("---" + System.lineSeparator()) ;
            } catch (Exception e) {
                System.out.println("Parser error: " + e.getMessage()) ;
                e.printStackTrace(System.err) ;
            }
        }
    ```
    
    `config.ttl` is the config file for Skosmos. The template can be found [here](https://github.com/NatLibFi/Skosmos/blob/c68a9715ced03c17906299f421fe97b27047566c/config.ttl.dist).
    
    Code worked with no issues, and for what's worth, here's the output:
    
    ```shell
    log4j:WARN No appenders could be found for logger (org.apache.jena.util.FileManager).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    PREFIX  void:  <http://rdfs.org/ns/void#>
    PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX  rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX  owl:  <http://www.w3.org/2002/07/owl#>
    PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
    PREFIX  dc:  <http://purl.org/dc/terms/>
    PREFIX  foaf:  <http://xmlns.com/foaf/0.1/>
    PREFIX  wv:  <http://vocab.org/waiver/terms/norms>
    PREFIX  sd:  <http://www.w3.org/ns/sparql-service-description#>
    PREFIX  skos:  <http://www.w3.org/2004/02/skos/core#>
    PREFIX  skosmos:  <http://purl.org/net/skosmos#>
    PREFIX  isothes:  <http://purl.org/iso25964/skos-thes#>
    PREFIX  mdrtype:  <http://publications.europa.eu/resource/authority/dataset-type/>
    PREFIX  :  <file:///home/kinow/Development/java/jena/jena/jena-arq/#>
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/net/skosmos#Configuration> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#sparqlEndpoint> "http://fuseki:3030/skosmos/sparql" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#sparqlDialect> "Generic" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#sparqlCollationEnabled> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#sparqlTimeout> "60"^^<http://www.w3.org/2001/XMLSchema#integer> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#httpTimeout> "60"^^<http://www.w3.org/2001/XMLSchema#integer> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#serviceName> "Skosmos" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#baseHref> "http://localhost:8000/" .
    ??1 <http://www.w3.org/2000/01/rdf-schema#label> "fi" .
    ??1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "fi_FI.utf8" .
    ??0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ??1 .
    ??0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> ??2 .
    ??3 <http://www.w3.org/2000/01/rdf-schema#label> "sv" .
    ??3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "sv_SE.utf8" .
    ??2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ??3 .
    ??2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> ??4 .
    ??5 <http://www.w3.org/2000/01/rdf-schema#label> "en" .
    ??5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "en_GB.utf8" .
    ??4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ??5 .
    ??4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#languages> ??0 .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#searchResultsSize> "20"^^<http://www.w3.org/2001/XMLSchema#integer> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#transitiveLimit> "1000"^^<http://www.w3.org/2001/XMLSchema#integer> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#logCaughtExceptions> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#logBrowserConsole> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#logFileName> "/tmp/skosmos.log" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#templateCache> "/tmp/skosmos-template-cache" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#customCss> "" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#feedbackAddress> "" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#feedbackSender> "" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#feedbackEnvelopeSender> "" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#uiLanguageDropdown> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#uiHoneypotEnabled> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#uiHoneypotTime> "5"^^<http://www.w3.org/2001/XMLSchema#integer> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#config> <http://purl.org/net/skosmos#globalPlugins> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/net/skosmos#Vocabulary> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/ns/void#Dataset> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/dc/terms/title> "YSA - Yleinen suomalainen asiasanasto"@fi .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/dc/terms/title> "YSA - Allmän tesaurus på finska"@sv .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/dc/terms/title> "YSA - General Finnish thesaurus"@en .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/dc/terms/subject> <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/dc/terms/type> <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://rdfs.org/ns/void#uriSpace> "http://www.yso.fi/onto/ysa/" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/net/skosmos#groupClass> <http://www.w3.org/2004/02/skos/core#Collection> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/net/skosmos#language> "fi" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/net/skosmos#shortName> "YSA" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/net/skosmos#feedbackRecipient> "vesa-posti@helsinki.fi" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/net/skosmos#showChangeList> "true" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://rdfs.org/ns/void#dataDump> <http://api.finto.fi/download/ysa/ysa-skos.ttl> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://rdfs.org/ns/void#sparqlEndpoint> <http://api.dev.finto.fi/sparql> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#ysa> <http://purl.org/net/skosmos#sparqlGraph> <http://www.yso.fi/onto/ysa/> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/net/skosmos#Vocabulary> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/ns/void#Dataset> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/dc/terms/title> "YSO - Yleinen suomalainen ontologia"@fi .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/dc/terms/title> "ALLFO - Allmän finländsk ontologi"@sv .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/dc/terms/title> "YSO - General Finnish ontology"@en .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/dc/terms/subject> <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/dc/terms/type> <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://rdfs.org/ns/void#uriSpace> "http://www.yso.fi/onto/yso/" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#language> "fi" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#language> "sv" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#language> "en" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#defaultLanguage> "fi" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#showTopConcepts> "true" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#showStatistics> "false" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#loadExternalResources> "false" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#shortName> "YSO" .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#shortName> "ALLFO"@sv .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#groupClass> <http://purl.org/iso25964/skos-thes#ConceptGroup> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#arrayClass> <http://purl.org/iso25964/skos-thes#ThesaurusArray> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://rdfs.org/ns/void#dataDump> <http://api.finto.fi/download/yso/yso-skos.ttl> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://rdfs.org/ns/void#sparqlEndpoint> <http://api.dev.finto.fi/sparql> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#sparqlGraph> <http://www.yso.fi/onto/yso/> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#yso> <http://purl.org/net/skosmos#mainConceptScheme> <http://www.yso.fi/onto/yso/> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#categories> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#ConceptScheme> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#categories> <http://www.w3.org/2004/02/skos/core#prefLabel> "Skosmos Vocabulary Categories"@en .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> <http://www.w3.org/2004/02/skos/core#topConceptOf> <file:///home/kinow/Development/java/jena/jena/jena-arq/#categories> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> <http://www.w3.org/2004/02/skos/core#inScheme> <file:///home/kinow/Development/java/jena/jena/jena-arq/#categories> .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> <http://www.w3.org/2004/02/skos/core#prefLabel> "Yleiskäsitteet"@fi .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> <http://www.w3.org/2004/02/skos/core#prefLabel> "Allmänna begrepp"@sv .
    <file:///home/kinow/Development/java/jena/jena/jena-arq/#cat_general> <http://www.w3.org/2004/02/skos/core#prefLabel> "General concepts"@en .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Тезаурус"@bg .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tezaurus"@cs .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesaurus"@da .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Thesaurus"@de .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Θησαυρός"@el .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Thesaurus"@en .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesaurus"@et .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesaurus"@fi .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Thésaurus"@fr .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Pojmovnik"@hr .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tezaurusz"@hu .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesauro"@it .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tēzaurs"@lv .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tezauras"@lt .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Teżawru"@mt .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Thesaurus"@nl .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesaurus"@no .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tezaurus"@pl .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesauro"@pt .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tezaur"@ro .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Synonymický slovník"@sk .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tezaver"@sl .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesauro"@es .
    <http://publications.europa.eu/resource/authority/dataset-type/THESAURUS> <http://www.w3.org/2004/02/skos/core#prefLabel> "Tesaurus"@sv .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Онтология"@bg .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologie"@cs .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologi"@da .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologie"@de .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Οντολογία"@el .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontology"@en .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontoloogia"@et .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologia"@fi .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologie"@fr .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologija"@hr .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontológia"@hu .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologia"@it .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontoloģija"@lv .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologija"@lt .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontoloġija"@mt .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologie"@nl .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologi"@no .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Struktura pojęciowa"@pl .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologia"@pt .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologie"@ro .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontológia"@sk .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologija"@sl .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontología"@es .
    <http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY> <http://www.w3.org/2004/02/skos/core#prefLabel> "Ontologi"@sv .
    Parsed query successfully!
    ---
    ```
    
    Thanks!


---

[GitHub] jena issue #455: JENA-1584: A Javacc Turtle parser for reference.

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/455
  
    Great test, thanks!
    
    It will register itself:
    
            Lang lang =  TurtleJavaccReaderRIOT.lang;
            TurtleJavaccReaderRIOT.register();
            RDFParser.create().forceLang(lang).source(FILE).build()
                .parse(StreamRDFLib.writer(System.out));
    
    It has a won't-clash MIME type ("text/turtle-jcc") and file extension ("ttljcc") even though it is not really for general use. `forceLang` cause the parser to always use the `lang` whatever the FILE may say.


---

[GitHub] jena pull request #455: JENA-1584: A Javacc Turtle parser for reference.

Posted by kinow <gi...@git.apache.org>.
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/jena/pull/455#discussion_r207735246
  
    --- Diff: jena-arq/src/main/java/org/apache/jena/riot/lang/extra/javacc/TokenMgrError.java ---
    @@ -0,0 +1,165 @@
    +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 6.0 */
    +/* JavaCCOptions: */
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.jena.riot.lang.extra.javacc;
    +
    +/** Token Manager Error. */
    +public class TokenMgrError extends Error
    +{
    +
    +  /**
    +   * The version identifier for this Serializable class.
    +   * Increment only if the <i>serialized</i> form of the
    +   * class changes.
    +   */
    +  private static final long serialVersionUID = 1L;
    +
    +  /*
    +   * Ordinals for various reasons why an Error of this type can be thrown.
    +   */
    +
    +  /**
    +   * Lexical error occurred.
    +   */
    +  static final int LEXICAL_ERROR = 0;
    +
    +  /**
    +   * An attempt was made to create a second instance of a static token manager.
    +   */
    +  static final int STATIC_LEXER_ERROR = 1;
    +
    +  /**
    +   * Tried to change to an invalid lexical state.
    +   */
    +  static final int INVALID_LEXICAL_STATE = 2;
    +
    +  /**
    +   * Detected (and bailed out of) an infinite loop in the token manager.
    +   */
    +  static final int LOOP_DETECTED = 3;
    +
    +  /**
    +   * Indicates the reason why the exception is thrown. It will have
    +   * one of the above 4 values.
    +   */
    +  int errorCode;
    +
    +  /**
    +   * Replaces unprintable characters by their escaped (or unicode escaped)
    +   * equivalents in the given string
    +   */
    +  protected static final String addEscapes(String str) {
    +    StringBuffer retval = new StringBuffer();
    --- End diff --
    
    See comment above about `StringBuffer` / `StringBuilder`


---

[GitHub] jena pull request #455: JENA-1584: A Javacc Turtle parser for reference.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jena/pull/455


---