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