Changeset 6935 for FCSSimpleEndpoint


Ignore:
Timestamp:
02/03/16 23:24:10 (8 years ago)
Author:
Oliver Schonefeld
Message:
  • update/add copyright
  • fix typo in class name
  • minor changes
Location:
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs
Files:
32 edited
1 moved

Legend:

Unmodified
Added
Removed
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/AdvancedDataViewWriter.java

    r6884 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
     
    1127
    1228
     29/**
     30 * Helper class for serializing Advanced data views. It can be used for writing
     31 * more than one, but it is <em>not thread-save</em>.
     32 */
    1333public class AdvancedDataViewWriter {
    1434    public enum Unit {
    15         ITEM,
    16         TIMESTAMP
     35        ITEM, TIMESTAMP
    1736    }
    1837    private static final long INITIAL_SEGMENT_ID = 1;
     
    2746
    2847
     48    /**
     49     * Constructor.
     50     *
     51     * @param unit
     52     *            the unit to be used for span offsets
     53     * @see Unit
     54     */
    2955    public AdvancedDataViewWriter(Unit unit) {
    3056        if (unit == null) {
     
    3561
    3662
     63    /**
     64     * Reset the writer for writing a new data view (instance).
     65     */
    3766    public void reset() {
    3867        nextSegmentId = INITIAL_SEGMENT_ID;
     
    4069
    4170
    42     private static final class Segment {
    43         private final String id;
    44         private final long start;
    45         private final long end;
    46         private final URI ref;
    47 
    48         private Segment(long id, long start, long end) {
    49             this.id = "s" + Long.toHexString(id);
    50             this.start = start;
    51             this.end = end;
    52             this.ref = null;
    53         }
    54     }
    55 
    56     private static final class Span {
    57         private final Segment segment;
    58         private final String value;
    59         private final String altValue;
    60         private final String highlight;
    61 
    62 
    63         private Span(Segment segment, String value, String altValue,
    64                 int highlight) {
    65             this.segment = segment;
    66             this.value = value;
    67             this.altValue = altValue;
    68             if (highlight != NO_HIGHLIGHT) {
    69                 this.highlight = "h" + Integer.toHexString(highlight);
    70             } else {
    71                 this.highlight = null;
    72             }
    73         }
    74     }
    75 
    76 
     71    /**
     72     * Add a span.
     73     *
     74     * @param layerId
     75     *            the span's layer id
     76     * @param start
     77     *            the span's start offset
     78     * @param end
     79     *            the span's end offset
     80     * @param value
     81     *            the span's content value or <code>null</code> if none
     82     * @throws IllegalArgumentException
     83     *             if any argument is invalid
     84     */
    7785    public void addSpan(URI layerId, long start, long end, String value) {
    7886        addSpan(layerId, start, end, value, null, NO_HIGHLIGHT);
     
    8088
    8189
     90    /**
     91     * Add a span.
     92     *
     93     * @param layerId
     94     *            the span's layer id
     95     * @param start
     96     *            the span's start offset
     97     * @param end
     98     *            the span's end offset
     99     * @param value
     100     *            the span's content value or <code>null</code> if none
     101     * @param highlight
     102     *            the highlight group
     103     * @throws IllegalArgumentException
     104     *             if any argument is invalid
     105     */
    82106    public void addSpan(URI layerId, long start, long end, String value,
    83107            int highlight) {
     
    86110
    87111
     112    /**
     113     * Add a span.
     114     *
     115     * @param layerId
     116     *            the span's layer id
     117     * @param start
     118     *            the span's start offset
     119     * @param end
     120     *            the span's end offset
     121     * @param value
     122     *            the span's content value or <code>null</code> if none
     123     * @param altValue
     124     *            the span's alternate value or <code>null</code> if none
     125     */
    88126    public void addSpan(URI layerId, long start, long end, String value,
    89127            String altValue) {
     
    92130
    93131
     132    /**
     133     * Add a span.
     134     *
     135     * @param layerId
     136     *            the span's layer id
     137     * @param start
     138     *            the span's start offset
     139     * @param end
     140     *            the span's end offset
     141     * @param value
     142     *            the span's content value or <code>null</code> if none
     143     * @param altValue
     144     * @param highlight
     145     *            the span's alternate value or <code>null</code> if none
     146     * @param highlight
     147     *            the highlight group
     148     * @throws IllegalArgumentException
     149     *             if any argument is invalid
     150     */
    94151    public void addSpan(URI layerId, long start, long end, String value,
    95152            String altValue, int highlight) {
     
    131188            if (segment.equals(span.segment)) {
    132189                // FIXME: better exception!
    133                 throw new IllegalArgumentException("segment already exists in layer");
     190                throw new IllegalArgumentException(
     191                        "segment already exists in layer");
    134192            }
    135193        }
     
    138196
    139197
     198    /**
     199     * Write the Advanced data view to the output stream.
     200     *
     201     * @param writer
     202     *            the writer to write to
     203     * @throws XMLStreamException
     204     *             if an error occurs
     205     */
    140206    public void writeAdvancedDataView(XMLStreamWriter writer)
    141207            throws XMLStreamException {
     
    204270    }
    205271
     272    private static final class Segment {
     273        private final String id;
     274        private final long start;
     275        private final long end;
     276        private final URI ref;
     277
     278
     279        private Segment(long id, long start, long end) {
     280            this.id = "s" + Long.toHexString(id);
     281            this.start = start;
     282            this.end = end;
     283            this.ref = null;
     284        }
     285    }
     286
     287    private static final class Span {
     288        private final Segment segment;
     289        private final String value;
     290        private final String altValue;
     291        private final String highlight;
     292
     293
     294        private Span(Segment segment, String value, String altValue,
     295                int highlight) {
     296            this.segment = segment;
     297            this.value = value;
     298            this.altValue = altValue;
     299            if (highlight != NO_HIGHLIGHT) {
     300                this.highlight = "h" + Integer.toHexString(highlight);
     301            } else {
     302                this.highlight = null;
     303            }
     304        }
     305    }
     306
    206307} // class AdvancedDataViewHelper
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/Constants.java

    r6850 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/DataView.java

    r5670 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
     
    6177    /**
    6278     * Get the identifier of this data view.
    63      * 
     79     *
    6480     * @return the identifier of the data view
    6581     */
     
    7187    /**
    7288     * Get the MIME type of this data view.
    73      * 
     89     *
    7490     * @return the MIME type of this data view
    7591     */
     
    8197    /**
    8298     * Get the delivery policy for this data view.
    83      * 
     99     *
    84100     * @return the delivery policy of this data view
    85101     * @see DeliveryPolicy
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/EndpointDescription.java

    r6830 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
     
    6581     * The implementation of this method <em>must</em> be thread-safe.
    6682     * </p>
    67      * 
     83     *
    6884     * @return the list of layers supported in Advanced Search by this endpoint
    6985     */
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/FCSQueryParser.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/Layer.java

    r6838 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfo.java

    r6830 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleEndpointSearchEngineBase.java

    r6849 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/XMLStreamWriterHelper.java

    r5670 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs;
    218
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/Constants.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * FCS-QL expression tree constants.
     22 */
    323public final class Constants {
     24    /**
     25     * Atom occurrence it not bound.
     26     */
    427    public static final int OCCURS_UNBOUNDED = -1;
    528
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/Expression.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     
    521
    622
     23/**
     24 * A FCS-QL expression tree SIMPLE expression node.
     25 */
    726public class Expression extends QueryNode {
    827    private final String qualifier;
     
    1332
    1433
     34    /**
     35     * Constructor.
     36     *
     37     * @param qualifier
     38     *            the layer identifier qualifier or <code>null</code> if none
     39     * @param identifier
     40     *            the layer identifier
     41     * @param operator
     42     *            the operator
     43     * @param regex
     44     *            the regular expression
     45     * @param regex_flags
     46     *            the regular expression flags or <code>null</code> of none
     47     */
    1548    Expression(String qualifier, String identifier, Operator operator,
    1649            String regex, Set<RegexFlag> regex_flags) {
     
    3265
    3366
     67    /**
     68     * Get the layer identifier.
     69     *
     70     * @return the layer identifier
     71     */
    3472    public String getLayerIdentifier() {
    3573        return identifier;
    3674    }
    3775
    38    
     76
     77    /**
     78     * Get the layer identifier qualifier.
     79     *
     80     * @return the layer identifier qualifier or <code>null</code> if none
     81     */
    3982    public String getLayerQualifier() {
    4083        return qualifier;
     
    4285
    4386
     87    /**
     88     * Get the operator.
     89     *
     90     * @return the operator
     91     */
    4492    public Operator getOperator() {
    4593        return operator;
     
    4795
    4896
     97    /**
     98     * Get the regex value.
     99     *
     100     * @return the regex value
     101     */
    49102    public String getRegexValue() {
    50103        return regex;
     
    52105
    53106
     107    /**
     108     * Get the regex flags set.
     109     *
     110     * @return the regex flags set or <code>null</code> if none
     111     */
    54112    public Set<RegexFlag> getRegexFlags() {
    55113        return regex_flags;
     
    97155    }
    98156
    99 }
     157} // class Expression
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/ExpressionAnd.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     
    420
    521
     22/**
     23 * A FCS-QL expression tree AND expression node.
     24 */
    625public class ExpressionAnd extends QueryNode {
    726
     27    /**
     28     * Constructor.
     29     *
     30     * @param children child elements covered by AND expression.
     31     */
    832    ExpressionAnd(List<QueryNode> children) {
    933        super(QueryNodeType.EXPRESSION_AND, children);
     
    2145    }
    2246
    23 }
     47} // class ExpressionAnd
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/ExpressionGroup.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * A FCS-QL expression tree GROUP expression node.
     22 */
    323public class ExpressionGroup extends QueryNode {
    424
     25    /**
     26     * Constructor.
     27     *
     28     * @param content
     29     *            the group content
     30     */
    531    ExpressionGroup(QueryNode content) {
    632        super(QueryNodeType.EXPRESSION_GROUP, content);
     
    2955    }
    3056
    31 }
     57} // class ExpressionGroup
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/ExpressionNot.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
    319
     20/**
     21 * A FCS-QL expression tree NOT expression node.
     22 */
    423public class ExpressionNot extends QueryNode {
    524
     25    /**
     26     * Constructor.
     27     *
     28     * @param child
     29     *            the child expression
     30     */
    631    ExpressionNot(QueryNode child) {
    732        super(QueryNodeType.EXPRESSION_NOT, child);
     
    1944    }
    2045
    21    
     46
    2247    @Override
    2348    public void accept(QueryVisitor visitor) {
     
    2651    }
    2752
    28 }
     53} // class ExpressionNot
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/ExpressionOr.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     
    420
    521
     22/**
     23 * A FCS-QL expression tree OR expression node.
     24 */
    625public class ExpressionOr extends QueryNode {
    726
     27    /**
     28     * Constructor.
     29     *
     30     * @param children the children
     31     */
    832    ExpressionOr(List<QueryNode> children) {
    933        super(QueryNodeType.EXPRESSION_OR, children);
     
    1135
    1236
     37    /**
     38     * Get the OR expression operands
     39     *
     40     * @return a list of expressions
     41     */
    1342    public List<QueryNode> getOperands() {
    1443        return children;
    1544    }
    1645
    17    
     46
    1847    @Override
    1948    public void accept(QueryVisitor visitor) {
     
    2655    }
    2756
    28 }
     57} // class ExpressionOr
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/ExpressionWildcard.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * A FCS-QL expression tree WILDCARD expression node.
     22 */
    323public class ExpressionWildcard extends QueryNode {
    424
     
    1333    }
    1434
    15 }
     35} // class ExpressionWildcard
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/Operator.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * FCS-QL operators.
     22 */
    323public enum Operator {
     24    /**
     25     * EQUALS operator.
     26     */
    427    EQUALS {
    528        @Override
     
    831        }
    932    },
     33    /**
     34     * NOT-EQUALS operator.
     35     */
    1036    NOT_EQUALS {
    1137        @Override
     
    1642
    1743    abstract String toDisplayString();
    18 }
     44
     45} // enum Operator
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryDisjunction.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
    319import java.util.List;
    420
     21
     22/**
     23 * A FCS-QL expression tree QR query
     24 */
    525public class QueryDisjunction extends QueryNode {
    6 
     26    /**
     27     * Constructor.
     28     *
     29     * @param children
     30     *            the children
     31     */
    732    QueryDisjunction(List<QueryNode> children) {
    833        super(QueryNodeType.QUERY_DISJUNCTION, children);
     
    2045    }
    2146
    22 }
     47} // class QueryDisjunction
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryGroup.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * A FCS-QL expression tree GROUP query node.
     22 */
    323public class QueryGroup extends QueryNode {
    4     private int minOccurs;
    5     private int maxOccurs;
     24    private final int minOccurs;
     25    private final int maxOccurs;
    626
    727
     28    /**
     29     * Constructor.
     30     *
     31     * @param content
     32     *            the child
     33     * @param minOccurs
     34     *            the minimum occurrence
     35     * @param maxOccurs
     36     *            the maximum occurrence
     37     */
    838    QueryGroup(QueryNode content, int minOccurs, int maxOccurs) {
    939        super(QueryNodeType.QUERY_GROUP, content);
     
    1343
    1444
     45    /**
     46     * Get the group content.
     47     *
     48     * @return the content of the GROUP query
     49     */
    1550    public QueryNode getContent() {
    1651        return children.get(0);
     
    1853
    1954
     55    /**
     56     * Get the minimum occurrence of group content.
     57     *
     58     * @return the minimum occurrence
     59     *
     60     */
    2061    public int getMinOccurs() {
    2162        return minOccurs;
     
    2364
    2465
     66    /**
     67     * Get the maximum occurrence of group content.
     68     *
     69     * @return the maximum occurrence
     70     *
     71     */
    2572    public int getMaxOccurs() {
    2673        return maxOccurs;
     
    69116    }
    70117
    71 }
     118} // class QueryGroup
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryNode.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     
    420import java.util.List;
    521
     22
     23/**
     24 * base class for FCS-QL expression tree nodes.
     25 *
     26 */
    627public abstract class QueryNode {
    728    protected final QueryNodeType nodeType;
     
    1031
    1132
     33    /**
     34     * Constructor.
     35     *
     36     * @param nodeType
     37     *            the type of the node
     38     * @param children
     39     *            the children of this node or <code>null</code> if none
     40     */
    1241    protected QueryNode(QueryNodeType nodeType, List<QueryNode> children) {
    1342        this.nodeType = nodeType;
     
    2352
    2453
     54    /**
     55     * Constructor.
     56     *
     57     * @param nodeType
     58     *            the type of the node
     59     * @param child
     60     *            the child of this node or <code>null</code> if none
     61     */
    2562    protected QueryNode(QueryNodeType nodeType, QueryNode child) {
    2663        this.nodeType = nodeType;
     
    3471
    3572
     73    /**
     74     * Constructor.
     75     *
     76     * @param nodeType
     77     *            the type of the node
     78     */
    3679    protected QueryNode(QueryNodeType nodeType) {
    3780        this.nodeType = nodeType;
     
    4083
    4184
     85    /**
     86     * Get the node type of this node.
     87     *
     88     * @return the node type
     89     */
    4290    public QueryNodeType getNodeType() {
    4391        return nodeType;
     
    4593
    4694
     95    /**
     96     * Get the parent node of this node.
     97     *
     98     * @return the parent node or <code>null</code> if this is the root node
     99     */
    47100    public QueryNode getParent() {
    48101        return parent;
     
    50103
    51104
     105    /**
     106     * The children of this node.
     107     *
     108     * @return the list of children of this node
     109     */
    52110    public List<QueryNode> getChildren() {
    53111        return children;
     
    55113
    56114
     115    /**
     116     * Get the number of children of this node.
     117     *
     118     * @return the number of children of this node
     119     */
    57120    public int getChildCount() {
    58121        final List<QueryNode> children = getChildren();
     
    61124
    62125
     126    /**
     127     * Get a child node by index.
     128     *
     129     * @param idx
     130     *            the index of the child node
     131     * @return the child node of this node or <code>null</code> if index is out
     132     *         of bounds
     133     */
    63134    public QueryNode getChild(int idx) {
    64135        final List<QueryNode> children = getChildren();
     
    72143
    73144
     145    /**
     146     * Get this first child node.
     147     *
     148     * @return the first child node of this node or <code>null</code> if none
     149     */
    74150    public QueryNode getFirstChild() {
    75151        return getChild(0);
     
    77153
    78154
     155    /**
     156     * Get this last child node.
     157     *
     158     * @return the last child node of this node or <code>null</code> if none
     159     */
    79160    public QueryNode getLastChild() {
    80161        return getChild(getChildCount() - 1);
     
    82163
    83164
     165    /**
     166     * Get a child node of specified type by index. Only child nodes of the
     167     * requested type are counted.
     168     *
     169     * @param clazz
     170     *            the type to nodes to be considered
     171     * @param idx
     172     *            the index of the child node
     173     * @return the child node of this node or <code>null</code> if no child was
     174     *         found
     175     */
    84176    public <T extends QueryNode> T getChild(Class<T> clazz, int idx) {
    85177        final List<QueryNode> children = getChildren();
     
    99191
    100192
     193    /**
     194     * Get a first child node of specified type.
     195     *
     196     * @return the child node of this node or <code>null</code> if no child was
     197     *         found
     198     */
    101199    public <T extends QueryNode> T getFirstChild(Class<T> clazz) {
    102200            return getChild(clazz, 0);
     
    155253    }
    156254
    157 }
     255} // abstract class QueryNode
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryNodeType.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * Node types of FCS-QL expression tree nodes.
     22 */
    323public enum QueryNodeType {
     24    /**
     25     * segment query
     26     */
    427    QUERY_SEGMENT {
    528        @Override
     
    831        }
    932    },
     33    /**
     34     * group query
     35     */
    1036    QUERY_GROUP {
    1137        @Override
     
    1440        }
    1541    },
     42    /**
     43     * sequence query
     44     */
    1645    QUERY_SEQUENCE {
    1746        @Override
     
    2049        }
    2150    },
     51    /**
     52     * or query
     53     */
    2254    QUERY_DISJUNCTION {
    2355        @Override
     
    2658        }
    2759    },
     60    /**
     61     * query with within part
     62     */
    2863    QUERY_WITH_WITHIN {
    2964        @Override
     
    3267        }
    3368    },
     69    /**
     70     * simple expression
     71     */
    3472    EXPRESSION {
    3573        @Override
     
    3876        }
    3977    },
     78    /**
     79     * wildcard expression
     80     */
    4081    EXPRESSION_WILDCARD {
    4182        @Override
     
    4485        }
    4586    },
     87    /**
     88     * group expression
     89     */
    4690    EXPRESSION_GROUP {
    4791        @Override
     
    5094        }
    5195    },
     96    /**
     97     * or expression
     98     */
    5299    EXPRESSION_OR {
    53100        @Override
     
    56103        }
    57104    },
     105    /**
     106     * and expression
     107     */
    58108    EXPRESSION_AND {
    59109        @Override
     
    62112        }
    63113    },
     114    /**
     115     * not expression
     116     */
    64117    EXPRESSION_NOT {
    65118        @Override
     
    68121        }
    69122    },
     123    /**
     124     * simple within part
     125     */
    70126    SIMPLE_WITHIN {
    71127        @Override
     
    76132
    77133    abstract String toDisplayString();
    78 }
     134
     135} // enum QueryNodeType
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryParser.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     
    4763
    4864
     65/**
     66 * A FCS-QL query parser that produces FCS-QL expression trees.
     67 */
    4968public class QueryParser {
    5069    private static final int[] REP_ZERO_OR_MORE =
     
    6483
    6584
     85    /**
     86     * Constructor.
     87     */
    6688    public QueryParser() {
    6789        this(DEFAULT_IDENTIFIER);
     
    6991
    7092
     93    /**
     94     * Constructor.
     95     *
     96     * @param defaultIdentifier
     97     *            the default identifer to be used for simple expressions
     98     */
    7199    public QueryParser(String defaultIdentifier) {
    72100        this.defaultIdentifier = defaultIdentifier;
     
    75103
    76104
     105    /**
     106     * Parse query.
     107     *
     108     * @param query
     109     *            the FCS-QL query
     110     * @return a FCS-QL expression tree
     111     * @throws QueryParserException
     112     *             if an error occurred
     113     */
    77114    public QueryNode parse(String query) throws QueryParserException {
    78115        final ErrorListener errorListener = new ErrorListener(query);
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryParserException.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * Query parser exception.
     22 *
     23 */
    324@SuppressWarnings("serial")
    425public class QueryParserException extends Exception {
     26    /**
     27     * Constrctur.
     28     *
     29     * @param message
     30     *            an error message
     31     * @param cause
     32     *            the underlying cause for the error
     33     */
    534    public QueryParserException(String message, Throwable cause) {
    635        super(message, cause);
     
    837
    938
     39    /**
     40     * Constructor.
     41     *
     42     * @param message
     43     *            an error message
     44     */
    1045    public QueryParserException(String message) {
    1146        this(message, null);
    1247    }
    1348
    14 }
     49} // class QueryParserException
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QuerySegment.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * A FCS-QL expression tree query segment node.
     22 */
    323public class QuerySegment extends QueryNode {
    424    private final int minOccurs;
     
    626
    727
     28    /**
     29     * Constructor.
     30     *
     31     * @param expression
     32     *            the expression
     33     * @param minOccurs
     34     *            the minimum occurrence
     35     * @param maxOccurs
     36     *            the maximum occurrence
     37     */
    838    QuerySegment(QueryNode expression, int minOccurs, int maxOccurs) {
    939        super(QueryNodeType.QUERY_SEGMENT, expression);
     
    1343
    1444
     45    /**
     46     * Get the expression for this segment.
     47     *
     48     * @return the expression
     49     */
    1550    public QueryNode getExpression() {
    1651        return children.get(0);
     
    1853
    1954
     55    /**
     56     * Get the minimum occurrence of this segment.
     57     *
     58     * @return the minimum occurrence
     59     *
     60     */
    2061    public int getMinOccurs() {
    2162        return minOccurs;
     
    2364
    2465
     66    /**
     67     * Get the maximum occurrence of this segment.
     68     *
     69     * @return the maximum occurrence
     70     *
     71     */
    2572    public int getMaxOccurs() {
    2673        return maxOccurs;
    2774    }
     75
    2876
    2977    @Override
     
    63111    }
    64112
    65 }
     113} // class QuerySegment
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QuerySequence.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
    319import java.util.List;
    420
     21
     22/**
     23 * A FCS-QL expression tree query sequence node.
     24 */
    525public class QuerySequence extends QueryNode {
    626
     27    /**
     28     * Constructor.
     29     *
     30     * @param children
     31     *            the children for this node
     32     */
    733    QuerySequence(List<QueryNode> children) {
    834        super(QueryNodeType.QUERY_SEQUENCE, children);
     
    2046    }
    2147
    22 }
     48} // class QuerySequence
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryVisitor.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * Interface implementing a Visitor pattern for FCS-QL expression trees.
     22 */
    323public interface QueryVisitor {
    4 
     24    /**
     25     * Visit a <em>segment</em> query node.
     26     *
     27     * @param querySegment
     28     *            the node to visit
     29     */
    530    public void visit(QuerySegment querySegment);
    631
    732
     33    /**
     34     * Visit a <em>group</em> query node.
     35     *
     36     * @param queryGroup
     37     *            the node to visit
     38     */
    839    public void visit(QueryGroup queryGroup);
    940
    1041
     42    /**
     43     * Visit a <em>sequence</em> query node.
     44     *
     45     * @param querySequence
     46     *            the node to visit
     47     */
    1148    public void visit(QuerySequence querySequence);
    1249
    1350
     51    /**
     52     * Visit a <em>or</em> query node.
     53     *
     54     * @param queryDisjunction
     55     *            the node to visit
     56     */
    1457    public void visit(QueryDisjunction queryDisjunction);
    1558
    1659
     60    /**
     61     * Visit a <em>query</em> with within node.
     62     *
     63     * @param queryWithWithin
     64     *            the node to visit
     65     */
    1766    public void visit(QueryWithWithin queryWithWithin);
    1867
    1968
    20     public void visit(Expression expressionBasic);
     69    /**
     70     * Visit a <em>simple</em> expression node.
     71     *
     72     * @param expression
     73     *            the node to visit
     74     */
     75    public void visit(Expression expression);
    2176
    2277
     78    /**
     79     * Visit a <em>wildcard</em> expression node.
     80     *
     81     * @param expressionWildcard
     82     *            the node to visit
     83     */
    2384    public void visit(ExpressionWildcard expressionWildcard);
    2485
    2586
     87    /**
     88     * Visit a <em>group</em> expression node.
     89     *
     90     * @param expressionGroup
     91     *            the node to visit
     92     */
    2693    public void visit(ExpressionGroup expressionGroup);
    2794
    2895
     96    /**
     97     * Visit a <em>or</em> expression node.
     98     *
     99     * @param expressionOr
     100     *            the node to visit
     101     */
    29102    public void visit(ExpressionOr expressionOr);
    30103
    31104
     105    /**
     106     * Visit a <em>and</em> expression node.
     107     *
     108     * @param expressionAnd
     109     *            the node to visit
     110     */
    32111    public void visit(ExpressionAnd expressionAnd);
    33112
    34113
     114    /**
     115     * Visit a <em>not</em> expression node.
     116     *
     117     * @param expressionNot
     118     *            the node to visit
     119     */
    35120    public void visit(ExpressionNot expressionNot);
    36121
    37122
     123    /**
     124     * Visit a <em>simple within</em> node.
     125     *
     126     * @param simpleWithin
     127     *            the node to visit
     128     */
    38129    public void visit(SimpleWithin simpleWithin);
    39130
    40 }
     131} // interface QueryVisitor
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryVistorAdapter.java

    r6934 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
    3 public class QueryVistorAdapeter implements QueryVisitor {
     19
     20/**
     21 * Convenience class to implement FCS-QL expression tree visitors. Default
     22 * method implementations do nothing.
     23 */
     24public class QueryVistorAdapter implements QueryVisitor {
    425
    526    @Override
     
    6283    }
    6384
    64 }
     85} // class QueryVistorAdapter
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryWithWithin.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
    319import java.util.Arrays;
    420
     21
     22/**
     23 * FCS-QL expression tree QUERY-WITH-WITHIN node.
     24 */
    525public class QueryWithWithin extends QueryNode {
    626
     27    /**
     28     * Constructor.
     29     *
     30     * @param query
     31     *            the query node
     32     * @param within
     33     *            the within node
     34     */
    735    QueryWithWithin(QueryNode query, QueryNode within) {
    836        super(QueryNodeType.QUERY_WITH_WITHIN, Arrays.asList(query, within));
     
    1038
    1139
     40    /**
     41     * Get the query clause.
     42     *
     43     * @return the query clause
     44     */
    1245    public QueryNode getQuery() {
    1346        return getChild(0);
     
    1548
    1649
     50    /**
     51     * Get the within clause (= search context)
     52     *
     53     * @return the witin clause
     54     */
    1755    public QueryNode getWithin() {
    1856        return getChild(1);
     
    2967    }
    3068
    31 }
     69} // class QueryWithWithin
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/RegexFlag.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * FCS-QL expression tree regex flags.
     22 */
    323public enum RegexFlag {
     24    /**
     25     * case insensitive.
     26     */
    427    CASE_INSENSITVE,
     28    /**
     29     * case sensitive.
     30     */
    531    CASE_SENSITVE,
     32    /**
     33     * match exactly (= literally).
     34     */
    635    LITERAL_MATCHING,
     36    /**
     37     * ignore all diacritics
     38     */
    739    IGNORE_DIACRITICS
    8 }
     40
     41} // enum RegexFlag
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/SimpleWithin.java

    r6882 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.parser;
    218
     19
     20/**
     21 * A FCS-QL expression tree SIMPLE WITHIN query node.
     22 */
    323public class SimpleWithin extends QueryNode {
     24    /**
     25     * The within scope.
     26     */
    427    public enum Scope {
     28        /**
     29         * sentence scope (small).
     30         */
    531        SENTENCE {
    632            @Override
     
    1036
    1137        },
     38        /**
     39         * utterance scope (small).
     40         */
    1241        UTTERANCE {
    1342            @Override
     
    1746
    1847        },
     48        /**
     49         * paragraph scope (medium).
     50         */
    1951        PARAGRAPH {
    2052            @Override
     
    2456
    2557        },
     58        /**
     59         * turn scope (medium).
     60         */
    2661        TURN {
    2762            @Override
     
    3065            }
    3166        },
     67        /**
     68         * text scope (large).
     69         */
    3270        TEXT {
    3371            @Override
     
    3674            }
    3775        },
     76        /**
     77         * session scope (large).
     78         */
    3879        SESSION {
    3980            @Override
     
    4889
    4990
    50     public SimpleWithin(Scope scope) {
     91    /**
     92     * Constructor.
     93     *
     94     * @param scope
     95     *            the scope
     96     */
     97    SimpleWithin(Scope scope) {
    5198        super(QueryNodeType.SIMPLE_WITHIN);
    5299        this.scope = scope;
     
    54101
    55102
     103    /**
     104     * Get the simple within scope
     105     *
     106     * @return the simple within scope
     107     */
    56108    public Scope getScope() {
    57109        return scope;
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/AbstractEndpointDescriptionBase.java

    r6830 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.utils;
    218
     
    1228/**
    1329 * An abstract base class for implementing endpoint descriptions. It already
    14  * implements the methods required for capabilities and supported dataviews.
     30 * implements the methods required for capabilities and supported data views.
    1531 *
    1632 * @see EndpointDescription
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleEndpointDescription.java

    r6830 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.utils;
    218
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleEndpointDescriptionParser.java

    r6838 r6935  
     1/**
     2 * This software is copyright (c) 2013-2016 by
     3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     4 * This is free software. You can redistribute it
     5 * and/or modify it under the terms described in
     6 * the GNU General Public License v3 of which you
     7 * should have received a copy. Otherwise you can download
     8 * it from
     9 *
     10 *   http://www.gnu.org/licenses/gpl-3.0.txt
     11 *
     12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
     13 *
     14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
     15 *  GNU General Public License v3
     16 */
    117package eu.clarin.sru.server.fcs.utils;
    218
Note: See TracChangeset for help on using the changeset viewer.