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