001    /***************************************************************************/
002    /*  Copyright (C) 2010-2011, Sebastian Hellmann                            */
003    /*  Note: If you need parts of NLP2RDF in another licence due to licence   */
004    /*  incompatibility, please mail hellmann@informatik.uni-leipzig.de        */
005    /*                                                                         */
006    /*  This file is part of NLP2RDF.                                          */
007    /*                                                                         */
008    /*  NLP2RDF is free software; you can redistribute it and/or modify        */
009    /*  it under the terms of the GNU General Public License as published by   */
010    /*  the Free Software Foundation; either version 3 of the License, or      */
011    /*  (at your option) any later version.                                    */
012    /*                                                                         */
013    /*  NLP2RDF is distributed in the hope that it will be useful,             */
014    /*  but WITHOUT ANY WARRANTY; without even the implied warranty of         */
015    /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the           */
016    /*  GNU General Public License for more details.                           */
017    /*                                                                         */
018    /*  You should have received a copy of the GNU General Public License      */
019    /*  along with this program. If not, see <http://www.gnu.org/licenses/>.   */
020    /***************************************************************************/
021    
022    package eu.lod2.nlp2rdf.schema.sso;
023    
024    import java.util.ArrayList;
025    import java.util.List;
026    import java.util.Iterator;
027    
028    import nl.tudelft.tbm.eeni.owl2java.model.jenautils.NullFilter;
029    
030    import org.apache.commons.logging.Log;
031    import org.apache.commons.logging.LogFactory;
032    
033    import com.hp.hpl.jena.enhanced.BuiltinPersonalities;
034    import com.hp.hpl.jena.enhanced.EnhGraph;
035    import com.hp.hpl.jena.enhanced.EnhNode;
036    import com.hp.hpl.jena.enhanced.Implementation;
037    import com.hp.hpl.jena.graph.Graph;
038    import com.hp.hpl.jena.graph.Node;
039    import com.hp.hpl.jena.ontology.Individual;
040    import com.hp.hpl.jena.ontology.OntClass;
041    import com.hp.hpl.jena.ontology.OntModel;
042    import com.hp.hpl.jena.ontology.Profile;
043    import com.hp.hpl.jena.ontology.impl.IndividualImpl;
044    import com.hp.hpl.jena.rdf.model.Resource;
045    import com.hp.hpl.jena.rdf.model.RDFNode;
046    import com.hp.hpl.jena.rdf.model.Statement;
047    import com.hp.hpl.jena.rdf.model.Literal;
048    import com.hp.hpl.jena.util.iterator.WrappedIterator;
049    import com.hp.hpl.jena.util.iterator.ExtendedIterator;
050    import com.hp.hpl.jena.util.iterator.Filter;
051    import com.hp.hpl.jena.util.iterator.Map1;
052    
053    // import interface
054    import eu.lod2.nlp2rdf.schema.sso.ISentence;
055    
056    /**
057     * Class http://nlp2rdf.lod2.eu/schema/sso/Sentence
058     */
059    public class Sentence extends IndividualImpl implements ISentence {
060    
061            private static Log log = LogFactory.getLog(Sentence.class);
062    
063            /**
064             * Implementation factory for Sentence
065             */
066            static final public Implementation factory = new Implementation() {
067    
068                    /**
069                     * Convert a Node into an instance of the class
070                     */
071                    public EnhNode wrap(Node n, EnhGraph eg) {
072                            if (canWrap(n, eg)) {
073                                    return new Sentence(n, eg);
074                            } else {
075                                    log.warn("Cannot convert node " + n.toString() + " to  Sentence");
076                                    return null;
077                            }
078                    }
079    
080                    /**
081                     * Return true iff the node can be converted to an instance of
082                     * this class (Sentence)
083                     */
084                    public boolean canWrap(Node n, EnhGraph eg) {
085                            Profile profile;
086                            if (eg instanceof OntModel)
087                                    profile = ((OntModel) eg).getProfile();
088                            else
089                                    return false;
090    
091                            if (!profile.isSupported(n, eg, Individual.class)) {
092                                    return false;
093                            }
094    
095                            Graph graph = eg.asGraph();
096                            return graph.contains(n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Sentence.asNode());
097                    }
098            };
099    
100            /**
101             * Filtering support for Sentence
102             */
103            static final public Filter<Sentence> nullFilter = new NullFilter<Sentence>();
104    
105            /**
106             * Mapping support for Sentence
107             */
108            public static <From> Map1<From, Sentence> mapperFrom(Class<From> from) {
109                    return new Map1<From, Sentence>() {
110                            @Override
111                            public Sentence map1(Object x) {
112                                    if (x instanceof Statement) {
113                                            Resource r = ((Statement) x).getResource();
114                                            if (r.canAs(Sentence.class))
115                                                    return r.as(Sentence.class);
116                                    } else if (x instanceof RDFNode) {
117                                            if (((RDFNode) x).canAs(Sentence.class))
118                                                    return ((RDFNode) x).as(Sentence.class);
119                                    }
120                                    return null;
121                            }
122                    };
123            }
124    
125            // Instantiate some mappers for general use
126            static final public Map1<Statement, Sentence> statementMapper = mapperFrom(Statement.class);
127            static final public Map1<Individual, Sentence> individualMapper = mapperFrom(Individual.class);
128            static final public Map1<RDFNode, Sentence> nodeMapper = mapperFrom(RDFNode.class);
129    
130            /**
131             * Generic functions from parent class
132             */
133            public Sentence(Node n, EnhGraph g) {
134                    super(n, g);
135            }
136    
137            /**
138             * Registers all custom classes with jena
139             */
140            public static void register() {
141                    log.debug("Registering custom class Sentence with jena");
142                    BuiltinPersonalities.model.add(Sentence.class, Sentence.factory);
143                    BuiltinPersonalities.model.add(eu.lod2.nlp2rdf.schema.sso.Sentence.class, Sentence.factory);
144            }
145    
146            /**
147             * Static Functions for instance handling
148             */
149            public static Sentence get(java.lang.String uri, OntModel ontModel) {
150                    Individual individual = ontModel.getIndividual(uri);
151                    return (eu.lod2.nlp2rdf.schema.sso.Sentence) individual.as(eu.lod2.nlp2rdf.schema.sso.Sentence.class);
152            }
153    
154            public static Sentence get(java.lang.String uri) {
155                    return get(uri, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
156            }
157    
158            public static Iterator<Sentence> iterate(OntModel ontModel) {
159                    ExtendedIterator<Individual> it = ontModel.listIndividuals(eu.lod2.nlp2rdf.schema.tools.Vocabulary.Sentence);
160                    return it.mapWith(individualMapper).filterDrop(nullFilter);
161            }
162    
163            public static Iterator<Sentence> iterate() {
164                    return iterate(eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
165            }
166    
167            public static List<Sentence> list(OntModel ontModel) {
168                    List<Sentence> list = new ArrayList<Sentence>();
169                    Iterator<Sentence> it = iterate(ontModel);
170                    while (it.hasNext()) {
171                            Sentence cls = it.next();
172                            list.add(cls);
173                    }
174                    return list;
175            }
176    
177            public static List<Sentence> list() {
178                    return list(eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
179            }
180    
181            public static Iterator<Sentence> iterate(boolean direct, OntModel ontModel) {
182                    OntClass cls = ontModel.getOntClass("http://nlp2rdf.lod2.eu/schema/sso/Sentence");
183                    ExtendedIterator<? extends RDFNode> it = cls.listInstances(direct);
184                    ExtendedIterator<RDFNode> nodeIt = new WrappedIterator<RDFNode>(it) {
185                    };
186                    return nodeIt.mapWith(nodeMapper).filterDrop(nullFilter);
187            }
188    
189            public static Iterator<Sentence> iterate(boolean direct) {
190                    return iterate(direct, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
191            }
192    
193            public static List<Sentence> list(boolean direct, OntModel ontModel) {
194                    List<Sentence> list = new ArrayList<Sentence>();
195                    Iterator<Sentence> it = iterate(direct, ontModel);
196                    while (it.hasNext()) {
197                            Sentence cls = it.next();
198                            list.add(cls);
199                    }
200                    return list;
201            }
202    
203            public static List<Sentence> list(boolean direct) {
204                    return list(direct, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
205            }
206    
207            public static int count(OntModel ontModel) {
208                    int count = 0;
209                    Iterator<Sentence> it = iterate(ontModel);
210                    while (it.hasNext()) {
211                            it.next();
212                            count++;
213                    }
214                    return count;
215            }
216    
217            public static int count() {
218                    return count(eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
219            }
220    
221            public static int count(boolean direct, OntModel ontModel) {
222                    int count = 0;
223                    Iterator<Sentence> it = iterate(direct, ontModel);
224                    while (it.hasNext()) {
225                            it.next();
226                            count++;
227                    }
228                    return count;
229            }
230    
231            public static int count(boolean direct) {
232                    return count(direct, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
233            }
234    
235            public static boolean exists(java.lang.String uri, OntModel ontModel) {
236                    Individual individual = ontModel.getIndividual(uri);
237                    if (individual != null)
238                            return true;
239                    return false;
240            }
241    
242            public static boolean exists(java.lang.String uri) {
243                    return exists(uri, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
244            }
245    
246            public static Sentence create(java.lang.String uri, OntModel ontModel) {
247                    return (Sentence) ontModel.createOntResource(Sentence.class, eu.lod2.nlp2rdf.schema.tools.Vocabulary.Sentence, uri);
248            }
249    
250            public static Sentence create(OntModel ontModel) {
251                    return create(null, ontModel);
252            }
253    
254            public static Sentence create(java.lang.String uri) {
255                    return create(uri, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
256            }
257    
258            public static Sentence create() {
259                    return create(null, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
260            }
261    
262            public static void delete(java.lang.String uri, OntModel ontModel) {
263                    eu.lod2.nlp2rdf.schema.tools.Factory.deleteInstance(uri, ontModel);
264            }
265    
266            public static void delete(java.lang.String uri) {
267                    eu.lod2.nlp2rdf.schema.tools.Factory.deleteInstance(uri);
268            }
269    
270            /**
271             * Domain property previousSentence
272             * with uri http://nlp2rdf.lod2.eu/schema/sso/previousSentence
273             */
274            public boolean existsPreviousSentence() {
275                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentence);
276            }
277    
278            public boolean hasPreviousSentence(eu.lod2.nlp2rdf.schema.sso.ISentence sentenceValue) {
279                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentence, sentenceValue);
280            }
281    
282            public eu.lod2.nlp2rdf.schema.sso.Sentence getPreviousSentence() {
283                    RDFNode n = getPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentence);
284                    if (n.canAs(eu.lod2.nlp2rdf.schema.sso.Sentence.class))
285                            return (eu.lod2.nlp2rdf.schema.sso.Sentence) n.as(eu.lod2.nlp2rdf.schema.sso.Sentence.class);
286                    else {
287                            log.warn("Could not convert previousSentence of " + getURI() + " (" + n + ") to type Sentence");
288                            return null;
289                    }
290            }
291    
292            public void setPreviousSentence(eu.lod2.nlp2rdf.schema.sso.ISentence sentenceValue) {
293                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentence);
294                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentence, sentenceValue);
295            }
296    
297            public void removePreviousSentence() {
298                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentence);
299            }
300    
301            /**
302             * Domain property nextSentence
303             * with uri http://nlp2rdf.lod2.eu/schema/sso/nextSentence
304             */
305            public boolean existsNextSentence() {
306                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.nextSentence);
307            }
308    
309            public boolean hasNextSentence(eu.lod2.nlp2rdf.schema.sso.ISentence sentenceValue) {
310                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.nextSentence, sentenceValue);
311            }
312    
313            public eu.lod2.nlp2rdf.schema.sso.Sentence getNextSentence() {
314                    RDFNode n = getPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.nextSentence);
315                    if (n.canAs(eu.lod2.nlp2rdf.schema.sso.Sentence.class))
316                            return (eu.lod2.nlp2rdf.schema.sso.Sentence) n.as(eu.lod2.nlp2rdf.schema.sso.Sentence.class);
317                    else {
318                            log.warn("Could not convert nextSentence of " + getURI() + " (" + n + ") to type Sentence");
319                            return null;
320                    }
321            }
322    
323            public void setNextSentence(eu.lod2.nlp2rdf.schema.sso.ISentence sentenceValue) {
324                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.nextSentence);
325                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.nextSentence, sentenceValue);
326            }
327    
328            public void removeNextSentence() {
329                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.nextSentence);
330            }
331    
332            /**
333             * Domain property word
334             * with uri http://nlp2rdf.lod2.eu/schema/sso/word
335             */
336            public boolean existsWord() {
337                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.word);
338            }
339    
340            public boolean hasWord(eu.lod2.nlp2rdf.schema.sso.IWord wordValue) {
341                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.word, wordValue);
342            }
343    
344            public int countWord() {
345                    int count = 0;
346                    Iterator<eu.lod2.nlp2rdf.schema.sso.Word> it = iterateWord();
347                    while (it.hasNext()) {
348                            it.next();
349                            count++;
350                    }
351                    return count;
352            }
353    
354            public Iterator<eu.lod2.nlp2rdf.schema.sso.Word> iterateWord() {
355                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.word);
356                    return it.mapWith(eu.lod2.nlp2rdf.schema.sso.Word.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.sso.Word.nullFilter);
357            }
358    
359            public List<eu.lod2.nlp2rdf.schema.sso.Word> listWord() {
360                    List<eu.lod2.nlp2rdf.schema.sso.Word> list = new ArrayList<eu.lod2.nlp2rdf.schema.sso.Word>();
361                    Iterator<eu.lod2.nlp2rdf.schema.sso.Word> it = iterateWord();
362                    while (it.hasNext()) {
363                            eu.lod2.nlp2rdf.schema.sso.Word inst = it.next();
364                            list.add(inst);
365                    }
366                    return list;
367            }
368    
369            public void addWord(eu.lod2.nlp2rdf.schema.sso.IWord wordValue) {
370                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.word, wordValue);
371            }
372    
373            public void addAllWord(List<? extends eu.lod2.nlp2rdf.schema.sso.IWord> wordList) {
374                    for (eu.lod2.nlp2rdf.schema.sso.IWord o : wordList)
375                            addWord(o);
376    
377            }
378    
379            public void removeWord(eu.lod2.nlp2rdf.schema.sso.IWord wordValue) {
380                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.word, wordValue);
381            }
382    
383            public void removeAllWord() {
384                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.word);
385            }
386    
387            /**
388             * Domain property firstWord
389             * with uri http://nlp2rdf.lod2.eu/schema/sso/firstWord
390             */
391            public boolean existsFirstWord() {
392                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.firstWord);
393            }
394    
395            public boolean hasFirstWord(eu.lod2.nlp2rdf.schema.sso.IWord wordValue) {
396                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.firstWord, wordValue);
397            }
398    
399            public eu.lod2.nlp2rdf.schema.sso.Word getFirstWord() {
400                    RDFNode n = getPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.firstWord);
401                    if (n.canAs(eu.lod2.nlp2rdf.schema.sso.Word.class))
402                            return (eu.lod2.nlp2rdf.schema.sso.Word) n.as(eu.lod2.nlp2rdf.schema.sso.Word.class);
403                    else {
404                            log.warn("Could not convert firstWord of " + getURI() + " (" + n + ") to type Word");
405                            return null;
406                    }
407            }
408    
409            public void setFirstWord(eu.lod2.nlp2rdf.schema.sso.IWord wordValue) {
410                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.firstWord);
411                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.firstWord, wordValue);
412            }
413    
414            public void removeFirstWord() {
415                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.firstWord);
416            }
417    
418            /**
419             * Domain property lastWord
420             * with uri http://nlp2rdf.lod2.eu/schema/sso/lastWord
421             */
422            public boolean existsLastWord() {
423                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.lastWord);
424            }
425    
426            public boolean hasLastWord(eu.lod2.nlp2rdf.schema.sso.IWord wordValue) {
427                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.lastWord, wordValue);
428            }
429    
430            public eu.lod2.nlp2rdf.schema.sso.Word getLastWord() {
431                    RDFNode n = getPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.lastWord);
432                    if (n.canAs(eu.lod2.nlp2rdf.schema.sso.Word.class))
433                            return (eu.lod2.nlp2rdf.schema.sso.Word) n.as(eu.lod2.nlp2rdf.schema.sso.Word.class);
434                    else {
435                            log.warn("Could not convert lastWord of " + getURI() + " (" + n + ") to type Word");
436                            return null;
437                    }
438            }
439    
440            public void setLastWord(eu.lod2.nlp2rdf.schema.sso.IWord wordValue) {
441                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.lastWord);
442                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.lastWord, wordValue);
443            }
444    
445            public void removeLastWord() {
446                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.lastWord);
447            }
448    
449            /**
450             * Domain property previousSentenceTrans
451             * with uri http://nlp2rdf.lod2.eu/schema/sso/previousSentenceTrans
452             */
453            public boolean existsPreviousSentenceTrans() {
454                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentenceTrans);
455            }
456    
457            public boolean hasPreviousSentenceTrans(eu.lod2.nlp2rdf.schema.sso.ISentence sentenceValue) {
458                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentenceTrans, sentenceValue);
459            }
460    
461            public int countPreviousSentenceTrans() {
462                    int count = 0;
463                    Iterator<eu.lod2.nlp2rdf.schema.sso.Sentence> it = iteratePreviousSentenceTrans();
464                    while (it.hasNext()) {
465                            it.next();
466                            count++;
467                    }
468                    return count;
469            }
470    
471            public Iterator<eu.lod2.nlp2rdf.schema.sso.Sentence> iteratePreviousSentenceTrans() {
472                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentenceTrans);
473                    return it.mapWith(eu.lod2.nlp2rdf.schema.sso.Sentence.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.sso.Sentence.nullFilter);
474            }
475    
476            public List<eu.lod2.nlp2rdf.schema.sso.Sentence> listPreviousSentenceTrans() {
477                    List<eu.lod2.nlp2rdf.schema.sso.Sentence> list = new ArrayList<eu.lod2.nlp2rdf.schema.sso.Sentence>();
478                    Iterator<eu.lod2.nlp2rdf.schema.sso.Sentence> it = iteratePreviousSentenceTrans();
479                    while (it.hasNext()) {
480                            eu.lod2.nlp2rdf.schema.sso.Sentence inst = it.next();
481                            list.add(inst);
482                    }
483                    return list;
484            }
485    
486            public void addPreviousSentenceTrans(eu.lod2.nlp2rdf.schema.sso.ISentence sentenceValue) {
487                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentenceTrans, sentenceValue);
488            }
489    
490            public void addAllPreviousSentenceTrans(List<? extends eu.lod2.nlp2rdf.schema.sso.ISentence> sentenceList) {
491                    for (eu.lod2.nlp2rdf.schema.sso.ISentence o : sentenceList)
492                            addPreviousSentenceTrans(o);
493    
494            }
495    
496            public void removePreviousSentenceTrans(eu.lod2.nlp2rdf.schema.sso.ISentence sentenceValue) {
497                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentenceTrans, sentenceValue);
498            }
499    
500            public void removeAllPreviousSentenceTrans() {
501                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.previousSentenceTrans);
502            }
503    
504            /**
505             * Domain property superString
506             * with uri http://nlp2rdf.lod2.eu/schema/string/superString
507             */
508            public boolean existsSuperString() {
509                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString);
510            }
511    
512            public boolean hasSuperString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
513                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString, stringValue);
514            }
515    
516            public int countSuperString() {
517                    int count = 0;
518                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperString();
519                    while (it.hasNext()) {
520                            it.next();
521                            count++;
522                    }
523                    return count;
524            }
525    
526            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSuperString() {
527                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString);
528                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
529            }
530    
531            public List<eu.lod2.nlp2rdf.schema.str.String> listSuperString() {
532                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
533                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperString();
534                    while (it.hasNext()) {
535                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
536                            list.add(inst);
537                    }
538                    return list;
539            }
540    
541            public void addSuperString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
542                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString, stringValue);
543            }
544    
545            public void addAllSuperString(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
546                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
547                            addSuperString(o);
548    
549            }
550    
551            public void removeSuperString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
552                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString, stringValue);
553            }
554    
555            public void removeAllSuperString() {
556                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString);
557            }
558    
559            /**
560             * Domain property subString
561             * with uri http://nlp2rdf.lod2.eu/schema/string/subString
562             */
563            public boolean existsSubString() {
564                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString);
565            }
566    
567            public boolean hasSubString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
568                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString, stringValue);
569            }
570    
571            public int countSubString() {
572                    int count = 0;
573                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubString();
574                    while (it.hasNext()) {
575                            it.next();
576                            count++;
577                    }
578                    return count;
579            }
580    
581            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSubString() {
582                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString);
583                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
584            }
585    
586            public List<eu.lod2.nlp2rdf.schema.str.String> listSubString() {
587                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
588                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubString();
589                    while (it.hasNext()) {
590                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
591                            list.add(inst);
592                    }
593                    return list;
594            }
595    
596            public void addSubString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
597                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString, stringValue);
598            }
599    
600            public void addAllSubString(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
601                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
602                            addSubString(o);
603    
604            }
605    
606            public void removeSubString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
607                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString, stringValue);
608            }
609    
610            public void removeAllSubString() {
611                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString);
612            }
613    
614            /**
615             * Domain property superStringTrans
616             * with uri http://nlp2rdf.lod2.eu/schema/string/superStringTrans
617             */
618            public boolean existsSuperStringTrans() {
619                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans);
620            }
621    
622            public boolean hasSuperStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
623                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans, stringValue);
624            }
625    
626            public int countSuperStringTrans() {
627                    int count = 0;
628                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperStringTrans();
629                    while (it.hasNext()) {
630                            it.next();
631                            count++;
632                    }
633                    return count;
634            }
635    
636            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSuperStringTrans() {
637                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans);
638                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
639            }
640    
641            public List<eu.lod2.nlp2rdf.schema.str.String> listSuperStringTrans() {
642                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
643                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperStringTrans();
644                    while (it.hasNext()) {
645                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
646                            list.add(inst);
647                    }
648                    return list;
649            }
650    
651            public void addSuperStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
652                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans, stringValue);
653            }
654    
655            public void addAllSuperStringTrans(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
656                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
657                            addSuperStringTrans(o);
658    
659            }
660    
661            public void removeSuperStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
662                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans, stringValue);
663            }
664    
665            public void removeAllSuperStringTrans() {
666                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans);
667            }
668    
669            /**
670             * Domain property subStringTrans
671             * with uri http://nlp2rdf.lod2.eu/schema/string/subStringTrans
672             */
673            public boolean existsSubStringTrans() {
674                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans);
675            }
676    
677            public boolean hasSubStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
678                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans, stringValue);
679            }
680    
681            public int countSubStringTrans() {
682                    int count = 0;
683                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubStringTrans();
684                    while (it.hasNext()) {
685                            it.next();
686                            count++;
687                    }
688                    return count;
689            }
690    
691            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSubStringTrans() {
692                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans);
693                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
694            }
695    
696            public List<eu.lod2.nlp2rdf.schema.str.String> listSubStringTrans() {
697                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
698                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubStringTrans();
699                    while (it.hasNext()) {
700                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
701                            list.add(inst);
702                    }
703                    return list;
704            }
705    
706            public void addSubStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
707                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans, stringValue);
708            }
709    
710            public void addAllSubStringTrans(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
711                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
712                            addSubStringTrans(o);
713    
714            }
715    
716            public void removeSubStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
717                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans, stringValue);
718            }
719    
720            public void removeAllSubStringTrans() {
721                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans);
722            }
723    
724            /**
725             * Domain property anchorOf
726             * with uri http://nlp2rdf.lod2.eu/schema/string/anchorOf
727             */
728            public boolean existsAnchorOf() {
729                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
730            }
731    
732            public boolean hasAnchorOf(java.lang.String stringValue) {
733                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
734            }
735    
736            public java.lang.String getAnchorOf() {
737                    RDFNode n = getPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
738                    if (n instanceof Literal) {
739                            Literal l = (Literal) n;
740                            return (java.lang.String) (nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.getString(l));
741                    } else {
742                            log.warn("Could not convert anchorOf of " + getURI() + " (" + n + ") to type String");
743                            return null;
744                    }
745            }
746    
747            public void setAnchorOf(java.lang.String stringValue) {
748                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
749                    nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
750                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
751                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf, literal);
752            }
753    
754            public void removeAnchorOf() {
755                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
756            }
757    
758            /**
759             * Domain property endIndex
760             * with uri http://nlp2rdf.lod2.eu/schema/string/endIndex
761             */
762            public boolean existsEndIndex() {
763                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
764            }
765    
766            public boolean hasEndIndex(java.lang.String stringValue) {
767                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
768            }
769    
770            public int countEndIndex() {
771                    int count = 0;
772                    Iterator<java.lang.String> it = iterateEndIndex();
773                    while (it.hasNext()) {
774                            it.next();
775                            count++;
776                    }
777                    return count;
778            }
779    
780            public Iterator<java.lang.String> iterateEndIndex() {
781                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
782                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
783            }
784    
785            public List<java.lang.String> listEndIndex() {
786                    List<java.lang.String> list = new ArrayList<java.lang.String>();
787                    Iterator<java.lang.String> it = iterateEndIndex();
788                    while (it.hasNext()) {
789                            java.lang.String inst = it.next();
790                            list.add(inst);
791                    }
792                    return list;
793            }
794    
795            public void addEndIndex(java.lang.String stringValue) {
796                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
797                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex, literal);
798            }
799    
800            public void addAllEndIndex(List<java.lang.String> stringList) {
801                    for (java.lang.String o : stringList)
802                            addEndIndex(o);
803            }
804    
805            public void removeEndIndex(java.lang.String stringValue) {
806                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
807                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex, literal);
808            }
809    
810            public void removeAllEndIndex() {
811                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
812    
813            }
814    
815            /**
816             * Domain property beginIndex
817             * with uri http://nlp2rdf.lod2.eu/schema/string/beginIndex
818             */
819            public boolean existsBeginIndex() {
820                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
821            }
822    
823            public boolean hasBeginIndex(java.lang.String stringValue) {
824                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
825            }
826    
827            public int countBeginIndex() {
828                    int count = 0;
829                    Iterator<java.lang.String> it = iterateBeginIndex();
830                    while (it.hasNext()) {
831                            it.next();
832                            count++;
833                    }
834                    return count;
835            }
836    
837            public Iterator<java.lang.String> iterateBeginIndex() {
838                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
839                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
840            }
841    
842            public List<java.lang.String> listBeginIndex() {
843                    List<java.lang.String> list = new ArrayList<java.lang.String>();
844                    Iterator<java.lang.String> it = iterateBeginIndex();
845                    while (it.hasNext()) {
846                            java.lang.String inst = it.next();
847                            list.add(inst);
848                    }
849                    return list;
850            }
851    
852            public void addBeginIndex(java.lang.String stringValue) {
853                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
854                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex, literal);
855            }
856    
857            public void addAllBeginIndex(List<java.lang.String> stringList) {
858                    for (java.lang.String o : stringList)
859                            addBeginIndex(o);
860            }
861    
862            public void removeBeginIndex(java.lang.String stringValue) {
863                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
864                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex, literal);
865            }
866    
867            public void removeAllBeginIndex() {
868                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
869    
870            }
871    
872            /**
873             * Domain property rightContext
874             * with uri http://nlp2rdf.lod2.eu/schema/string/rightContext
875             */
876            public boolean existsRightContext() {
877                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
878            }
879    
880            public boolean hasRightContext(java.lang.String stringValue) {
881                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
882            }
883    
884            public int countRightContext() {
885                    int count = 0;
886                    Iterator<java.lang.String> it = iterateRightContext();
887                    while (it.hasNext()) {
888                            it.next();
889                            count++;
890                    }
891                    return count;
892            }
893    
894            public Iterator<java.lang.String> iterateRightContext() {
895                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
896                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
897            }
898    
899            public List<java.lang.String> listRightContext() {
900                    List<java.lang.String> list = new ArrayList<java.lang.String>();
901                    Iterator<java.lang.String> it = iterateRightContext();
902                    while (it.hasNext()) {
903                            java.lang.String inst = it.next();
904                            list.add(inst);
905                    }
906                    return list;
907            }
908    
909            public void addRightContext(java.lang.String stringValue) {
910                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
911                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext, literal);
912            }
913    
914            public void addAllRightContext(List<java.lang.String> stringList) {
915                    for (java.lang.String o : stringList)
916                            addRightContext(o);
917            }
918    
919            public void removeRightContext(java.lang.String stringValue) {
920                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
921                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext, literal);
922            }
923    
924            public void removeAllRightContext() {
925                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
926    
927            }
928    
929            /**
930             * Domain property leftContext
931             * with uri http://nlp2rdf.lod2.eu/schema/string/leftContext
932             */
933            public boolean existsLeftContext() {
934                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
935            }
936    
937            public boolean hasLeftContext(java.lang.String stringValue) {
938                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
939            }
940    
941            public int countLeftContext() {
942                    int count = 0;
943                    Iterator<java.lang.String> it = iterateLeftContext();
944                    while (it.hasNext()) {
945                            it.next();
946                            count++;
947                    }
948                    return count;
949            }
950    
951            public Iterator<java.lang.String> iterateLeftContext() {
952                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
953                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
954            }
955    
956            public List<java.lang.String> listLeftContext() {
957                    List<java.lang.String> list = new ArrayList<java.lang.String>();
958                    Iterator<java.lang.String> it = iterateLeftContext();
959                    while (it.hasNext()) {
960                            java.lang.String inst = it.next();
961                            list.add(inst);
962                    }
963                    return list;
964            }
965    
966            public void addLeftContext(java.lang.String stringValue) {
967                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
968                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext, literal);
969            }
970    
971            public void addAllLeftContext(List<java.lang.String> stringList) {
972                    for (java.lang.String o : stringList)
973                            addLeftContext(o);
974            }
975    
976            public void removeLeftContext(java.lang.String stringValue) {
977                    Literal literal = nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
978                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext, literal);
979            }
980    
981            public void removeAllLeftContext() {
982                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
983    
984            }
985    
986    }