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.IPhrase;
055    
056    /**
057     * Class http://nlp2rdf.lod2.eu/schema/sso/Phrase
058     */
059    public class Phrase extends IndividualImpl implements IPhrase {
060    
061            private static Log log = LogFactory.getLog(Phrase.class);
062    
063            /**
064             * Implementation factory for Phrase
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 Phrase(n, eg);
074                            } else {
075                                    log.warn("Cannot convert node " + n.toString() + " to  Phrase");
076                                    return null;
077                            }
078                    }
079    
080                    /**
081                     * Return true iff the node can be converted to an instance of
082                     * this class (Phrase)
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.Phrase.asNode());
097                    }
098            };
099    
100            /**
101             * Filtering support for Phrase
102             */
103            static final public Filter<Phrase> nullFilter = new NullFilter<Phrase>();
104    
105            /**
106             * Mapping support for Phrase
107             */
108            public static <From> Map1<From, Phrase> mapperFrom(Class<From> from) {
109                    return new Map1<From, Phrase>() {
110                            @Override
111                            public Phrase map1(Object x) {
112                                    if (x instanceof Statement) {
113                                            Resource r = ((Statement) x).getResource();
114                                            if (r.canAs(Phrase.class))
115                                                    return r.as(Phrase.class);
116                                    } else if (x instanceof RDFNode) {
117                                            if (((RDFNode) x).canAs(Phrase.class))
118                                                    return ((RDFNode) x).as(Phrase.class);
119                                    }
120                                    return null;
121                            }
122                    };
123            }
124    
125            // Instantiate some mappers for general use
126            static final public Map1<Statement, Phrase> statementMapper = mapperFrom(Statement.class);
127            static final public Map1<Individual, Phrase> individualMapper = mapperFrom(Individual.class);
128            static final public Map1<RDFNode, Phrase> nodeMapper = mapperFrom(RDFNode.class);
129    
130            /**
131             * Generic functions from parent class
132             */
133            public Phrase(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 Phrase with jena");
142                    BuiltinPersonalities.model.add(Phrase.class, Phrase.factory);
143                    BuiltinPersonalities.model.add(eu.lod2.nlp2rdf.schema.sso.Phrase.class, Phrase.factory);
144            }
145    
146            /**
147             * Static Functions for instance handling
148             */
149            public static Phrase get(java.lang.String uri, OntModel ontModel) {
150                    Individual individual = ontModel.getIndividual(uri);
151                    return (eu.lod2.nlp2rdf.schema.sso.Phrase) individual.as(eu.lod2.nlp2rdf.schema.sso.Phrase.class);
152            }
153    
154            public static Phrase get(java.lang.String uri) {
155                    return get(uri, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
156            }
157    
158            public static Iterator<Phrase> iterate(OntModel ontModel) {
159                    ExtendedIterator<Individual> it = ontModel.listIndividuals(eu.lod2.nlp2rdf.schema.tools.Vocabulary.Phrase);
160                    return it.mapWith(individualMapper).filterDrop(nullFilter);
161            }
162    
163            public static Iterator<Phrase> iterate() {
164                    return iterate(eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
165            }
166    
167            public static List<Phrase> list(OntModel ontModel) {
168                    List<Phrase> list = new ArrayList<Phrase>();
169                    Iterator<Phrase> it = iterate(ontModel);
170                    while (it.hasNext()) {
171                            Phrase cls = it.next();
172                            list.add(cls);
173                    }
174                    return list;
175            }
176    
177            public static List<Phrase> list() {
178                    return list(eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
179            }
180    
181            public static Iterator<Phrase> iterate(boolean direct, OntModel ontModel) {
182                    OntClass cls = ontModel.getOntClass("http://nlp2rdf.lod2.eu/schema/sso/Phrase");
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<Phrase> iterate(boolean direct) {
190                    return iterate(direct, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
191            }
192    
193            public static List<Phrase> list(boolean direct, OntModel ontModel) {
194                    List<Phrase> list = new ArrayList<Phrase>();
195                    Iterator<Phrase> it = iterate(direct, ontModel);
196                    while (it.hasNext()) {
197                            Phrase cls = it.next();
198                            list.add(cls);
199                    }
200                    return list;
201            }
202    
203            public static List<Phrase> 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<Phrase> 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<Phrase> 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 Phrase create(java.lang.String uri, OntModel ontModel) {
247                    return (Phrase) ontModel.createOntResource(Phrase.class, eu.lod2.nlp2rdf.schema.tools.Vocabulary.Phrase, uri);
248            }
249    
250            public static Phrase create(OntModel ontModel) {
251                    return create(null, ontModel);
252            }
253    
254            public static Phrase create(java.lang.String uri) {
255                    return create(uri, eu.lod2.nlp2rdf.schema.tools.Factory.getDefaultModel());
256            }
257    
258            public static Phrase 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 child
272             * with uri http://nlp2rdf.lod2.eu/schema/sso/child
273             */
274            public boolean existsChild() {
275                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.child);
276            }
277    
278            public boolean hasChild(eu.lod2.nlp2rdf.schema.IThing thingValue) {
279                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.child, thingValue);
280            }
281    
282            public int countChild() {
283                    int count = 0;
284                    Iterator<eu.lod2.nlp2rdf.schema.Thing> it = iterateChild();
285                    while (it.hasNext()) {
286                            it.next();
287                            count++;
288                    }
289                    return count;
290            }
291    
292            public Iterator<eu.lod2.nlp2rdf.schema.Thing> iterateChild() {
293                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.child);
294                    return it.mapWith(eu.lod2.nlp2rdf.schema.Thing.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.Thing.nullFilter);
295            }
296    
297            public List<eu.lod2.nlp2rdf.schema.Thing> listChild() {
298                    List<eu.lod2.nlp2rdf.schema.Thing> list = new ArrayList<eu.lod2.nlp2rdf.schema.Thing>();
299                    Iterator<eu.lod2.nlp2rdf.schema.Thing> it = iterateChild();
300                    while (it.hasNext()) {
301                            eu.lod2.nlp2rdf.schema.Thing inst = it.next();
302                            list.add(inst);
303                    }
304                    return list;
305            }
306    
307            public void addChild(eu.lod2.nlp2rdf.schema.IThing thingValue) {
308                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.child, thingValue);
309            }
310    
311            public void addAllChild(List<? extends eu.lod2.nlp2rdf.schema.IThing> thingList) {
312                    for (eu.lod2.nlp2rdf.schema.IThing o : thingList)
313                            addChild(o);
314    
315            }
316    
317            public void removeChild(eu.lod2.nlp2rdf.schema.IThing thingValue) {
318                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.child, thingValue);
319            }
320    
321            public void removeAllChild() {
322                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.child);
323            }
324    
325            /**
326             * Domain property superString
327             * with uri http://nlp2rdf.lod2.eu/schema/string/superString
328             */
329            public boolean existsSuperString() {
330                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString);
331            }
332    
333            public boolean hasSuperString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
334                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString, stringValue);
335            }
336    
337            public int countSuperString() {
338                    int count = 0;
339                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperString();
340                    while (it.hasNext()) {
341                            it.next();
342                            count++;
343                    }
344                    return count;
345            }
346    
347            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSuperString() {
348                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString);
349                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
350            }
351    
352            public List<eu.lod2.nlp2rdf.schema.str.String> listSuperString() {
353                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
354                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperString();
355                    while (it.hasNext()) {
356                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
357                            list.add(inst);
358                    }
359                    return list;
360            }
361    
362            public void addSuperString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
363                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString, stringValue);
364            }
365    
366            public void addAllSuperString(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
367                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
368                            addSuperString(o);
369    
370            }
371    
372            public void removeSuperString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
373                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString, stringValue);
374            }
375    
376            public void removeAllSuperString() {
377                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superString);
378            }
379    
380            /**
381             * Domain property subString
382             * with uri http://nlp2rdf.lod2.eu/schema/string/subString
383             */
384            public boolean existsSubString() {
385                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString);
386            }
387    
388            public boolean hasSubString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
389                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString, stringValue);
390            }
391    
392            public int countSubString() {
393                    int count = 0;
394                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubString();
395                    while (it.hasNext()) {
396                            it.next();
397                            count++;
398                    }
399                    return count;
400            }
401    
402            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSubString() {
403                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString);
404                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
405            }
406    
407            public List<eu.lod2.nlp2rdf.schema.str.String> listSubString() {
408                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
409                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubString();
410                    while (it.hasNext()) {
411                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
412                            list.add(inst);
413                    }
414                    return list;
415            }
416    
417            public void addSubString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
418                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString, stringValue);
419            }
420    
421            public void addAllSubString(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
422                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
423                            addSubString(o);
424    
425            }
426    
427            public void removeSubString(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
428                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString, stringValue);
429            }
430    
431            public void removeAllSubString() {
432                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subString);
433            }
434    
435            /**
436             * Domain property superStringTrans
437             * with uri http://nlp2rdf.lod2.eu/schema/string/superStringTrans
438             */
439            public boolean existsSuperStringTrans() {
440                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans);
441            }
442    
443            public boolean hasSuperStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
444                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans, stringValue);
445            }
446    
447            public int countSuperStringTrans() {
448                    int count = 0;
449                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperStringTrans();
450                    while (it.hasNext()) {
451                            it.next();
452                            count++;
453                    }
454                    return count;
455            }
456    
457            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSuperStringTrans() {
458                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans);
459                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
460            }
461    
462            public List<eu.lod2.nlp2rdf.schema.str.String> listSuperStringTrans() {
463                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
464                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSuperStringTrans();
465                    while (it.hasNext()) {
466                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
467                            list.add(inst);
468                    }
469                    return list;
470            }
471    
472            public void addSuperStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
473                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans, stringValue);
474            }
475    
476            public void addAllSuperStringTrans(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
477                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
478                            addSuperStringTrans(o);
479    
480            }
481    
482            public void removeSuperStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
483                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans, stringValue);
484            }
485    
486            public void removeAllSuperStringTrans() {
487                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.superStringTrans);
488            }
489    
490            /**
491             * Domain property subStringTrans
492             * with uri http://nlp2rdf.lod2.eu/schema/string/subStringTrans
493             */
494            public boolean existsSubStringTrans() {
495                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans);
496            }
497    
498            public boolean hasSubStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
499                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans, stringValue);
500            }
501    
502            public int countSubStringTrans() {
503                    int count = 0;
504                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubStringTrans();
505                    while (it.hasNext()) {
506                            it.next();
507                            count++;
508                    }
509                    return count;
510            }
511    
512            public Iterator<eu.lod2.nlp2rdf.schema.str.String> iterateSubStringTrans() {
513                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans);
514                    return it.mapWith(eu.lod2.nlp2rdf.schema.str.String.statementMapper).filterDrop(eu.lod2.nlp2rdf.schema.str.String.nullFilter);
515            }
516    
517            public List<eu.lod2.nlp2rdf.schema.str.String> listSubStringTrans() {
518                    List<eu.lod2.nlp2rdf.schema.str.String> list = new ArrayList<eu.lod2.nlp2rdf.schema.str.String>();
519                    Iterator<eu.lod2.nlp2rdf.schema.str.String> it = iterateSubStringTrans();
520                    while (it.hasNext()) {
521                            eu.lod2.nlp2rdf.schema.str.String inst = it.next();
522                            list.add(inst);
523                    }
524                    return list;
525            }
526    
527            public void addSubStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
528                    addProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans, stringValue);
529            }
530    
531            public void addAllSubStringTrans(List<? extends eu.lod2.nlp2rdf.schema.str.IString> stringList) {
532                    for (eu.lod2.nlp2rdf.schema.str.IString o : stringList)
533                            addSubStringTrans(o);
534    
535            }
536    
537            public void removeSubStringTrans(eu.lod2.nlp2rdf.schema.str.IString stringValue) {
538                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans, stringValue);
539            }
540    
541            public void removeAllSubStringTrans() {
542                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.subStringTrans);
543            }
544    
545            /**
546             * Domain property anchorOf
547             * with uri http://nlp2rdf.lod2.eu/schema/string/anchorOf
548             */
549            public boolean existsAnchorOf() {
550                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
551            }
552    
553            public boolean hasAnchorOf(java.lang.String stringValue) {
554                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
555            }
556    
557            public java.lang.String getAnchorOf() {
558                    RDFNode n = getPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
559                    if (n instanceof Literal) {
560                            Literal l = (Literal) n;
561                            return (java.lang.String) (nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.getString(l));
562                    } else {
563                            log.warn("Could not convert anchorOf of " + getURI() + " (" + n + ") to type String");
564                            return null;
565                    }
566            }
567    
568            public void setAnchorOf(java.lang.String stringValue) {
569                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
570                    nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.createTypedLiteral((OntModel) getModel(), stringValue, "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
571                    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");
572                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf, literal);
573            }
574    
575            public void removeAnchorOf() {
576                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.anchorOf);
577            }
578    
579            /**
580             * Domain property endIndex
581             * with uri http://nlp2rdf.lod2.eu/schema/string/endIndex
582             */
583            public boolean existsEndIndex() {
584                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
585            }
586    
587            public boolean hasEndIndex(java.lang.String stringValue) {
588                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
589            }
590    
591            public int countEndIndex() {
592                    int count = 0;
593                    Iterator<java.lang.String> it = iterateEndIndex();
594                    while (it.hasNext()) {
595                            it.next();
596                            count++;
597                    }
598                    return count;
599            }
600    
601            public Iterator<java.lang.String> iterateEndIndex() {
602                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
603                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
604            }
605    
606            public List<java.lang.String> listEndIndex() {
607                    List<java.lang.String> list = new ArrayList<java.lang.String>();
608                    Iterator<java.lang.String> it = iterateEndIndex();
609                    while (it.hasNext()) {
610                            java.lang.String inst = it.next();
611                            list.add(inst);
612                    }
613                    return list;
614            }
615    
616            public void addEndIndex(java.lang.String stringValue) {
617                    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");
618                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex, literal);
619            }
620    
621            public void addAllEndIndex(List<java.lang.String> stringList) {
622                    for (java.lang.String o : stringList)
623                            addEndIndex(o);
624            }
625    
626            public void removeEndIndex(java.lang.String stringValue) {
627                    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");
628                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex, literal);
629            }
630    
631            public void removeAllEndIndex() {
632                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.endIndex);
633    
634            }
635    
636            /**
637             * Domain property beginIndex
638             * with uri http://nlp2rdf.lod2.eu/schema/string/beginIndex
639             */
640            public boolean existsBeginIndex() {
641                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
642            }
643    
644            public boolean hasBeginIndex(java.lang.String stringValue) {
645                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
646            }
647    
648            public int countBeginIndex() {
649                    int count = 0;
650                    Iterator<java.lang.String> it = iterateBeginIndex();
651                    while (it.hasNext()) {
652                            it.next();
653                            count++;
654                    }
655                    return count;
656            }
657    
658            public Iterator<java.lang.String> iterateBeginIndex() {
659                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
660                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
661            }
662    
663            public List<java.lang.String> listBeginIndex() {
664                    List<java.lang.String> list = new ArrayList<java.lang.String>();
665                    Iterator<java.lang.String> it = iterateBeginIndex();
666                    while (it.hasNext()) {
667                            java.lang.String inst = it.next();
668                            list.add(inst);
669                    }
670                    return list;
671            }
672    
673            public void addBeginIndex(java.lang.String stringValue) {
674                    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");
675                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex, literal);
676            }
677    
678            public void addAllBeginIndex(List<java.lang.String> stringList) {
679                    for (java.lang.String o : stringList)
680                            addBeginIndex(o);
681            }
682    
683            public void removeBeginIndex(java.lang.String stringValue) {
684                    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");
685                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex, literal);
686            }
687    
688            public void removeAllBeginIndex() {
689                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.beginIndex);
690    
691            }
692    
693            /**
694             * Domain property rightContext
695             * with uri http://nlp2rdf.lod2.eu/schema/string/rightContext
696             */
697            public boolean existsRightContext() {
698                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
699            }
700    
701            public boolean hasRightContext(java.lang.String stringValue) {
702                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
703            }
704    
705            public int countRightContext() {
706                    int count = 0;
707                    Iterator<java.lang.String> it = iterateRightContext();
708                    while (it.hasNext()) {
709                            it.next();
710                            count++;
711                    }
712                    return count;
713            }
714    
715            public Iterator<java.lang.String> iterateRightContext() {
716                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
717                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
718            }
719    
720            public List<java.lang.String> listRightContext() {
721                    List<java.lang.String> list = new ArrayList<java.lang.String>();
722                    Iterator<java.lang.String> it = iterateRightContext();
723                    while (it.hasNext()) {
724                            java.lang.String inst = it.next();
725                            list.add(inst);
726                    }
727                    return list;
728            }
729    
730            public void addRightContext(java.lang.String stringValue) {
731                    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");
732                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext, literal);
733            }
734    
735            public void addAllRightContext(List<java.lang.String> stringList) {
736                    for (java.lang.String o : stringList)
737                            addRightContext(o);
738            }
739    
740            public void removeRightContext(java.lang.String stringValue) {
741                    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");
742                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext, literal);
743            }
744    
745            public void removeAllRightContext() {
746                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.rightContext);
747    
748            }
749    
750            /**
751             * Domain property leftContext
752             * with uri http://nlp2rdf.lod2.eu/schema/string/leftContext
753             */
754            public boolean existsLeftContext() {
755                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
756            }
757    
758            public boolean hasLeftContext(java.lang.String stringValue) {
759                    return hasProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
760            }
761    
762            public int countLeftContext() {
763                    int count = 0;
764                    Iterator<java.lang.String> it = iterateLeftContext();
765                    while (it.hasNext()) {
766                            it.next();
767                            count++;
768                    }
769                    return count;
770            }
771    
772            public Iterator<java.lang.String> iterateLeftContext() {
773                    ExtendedIterator<Statement> it = listProperties(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
774                    return it.mapWith(nl.tudelft.tbm.eeni.owl2java.model.xsd.XsdUtils.objectAsStringMapper).filterDrop(new NullFilter<java.lang.String>());
775            }
776    
777            public List<java.lang.String> listLeftContext() {
778                    List<java.lang.String> list = new ArrayList<java.lang.String>();
779                    Iterator<java.lang.String> it = iterateLeftContext();
780                    while (it.hasNext()) {
781                            java.lang.String inst = it.next();
782                            list.add(inst);
783                    }
784                    return list;
785            }
786    
787            public void addLeftContext(java.lang.String stringValue) {
788                    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");
789                    setPropertyValue(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext, literal);
790            }
791    
792            public void addAllLeftContext(List<java.lang.String> stringList) {
793                    for (java.lang.String o : stringList)
794                            addLeftContext(o);
795            }
796    
797            public void removeLeftContext(java.lang.String stringValue) {
798                    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");
799                    removeProperty(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext, literal);
800            }
801    
802            public void removeAllLeftContext() {
803                    removeAll(eu.lod2.nlp2rdf.schema.tools.Vocabulary.leftContext);
804    
805            }
806    
807    }