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