Java Code Examples for org.apache.jena.rdf.model.RDFList#iterator()
The following examples show how to use
org.apache.jena.rdf.model.RDFList#iterator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TemplateImpl.java From Processor with Apache License 2.0 | 5 votes |
protected List<Locale> getLanguages(Property property) { if (property == null) throw new IllegalArgumentException("Property cannot be null"); List<Locale> languages = new ArrayList<>(); Resource langs = getPropertyResourceValue(property); if (langs != null) { if (!langs.canAs(RDFList.class)) { if (log.isErrorEnabled()) log.error("ldt:lang value is not an rdf:List on template '{}'", getURI()); throw new OntologyException("ldt:lang value is not an rdf:List on template '" + getURI() +"'"); } // could use list order as priority (quality value q=) RDFList list = langs.as(RDFList.class); ExtendedIterator<RDFNode> it = list.iterator(); try { while (it.hasNext()) { RDFNode langTag = it.next(); if (!langTag.isLiteral()) { if (log.isErrorEnabled()) log.error("Non-literal language tag (ldt:lang member) on template '{}'", getURI()); throw new OntologyException("Non-literal language tag (ldt:lang member) on template '" + getURI() +"'"); } languages.add(Locale.forLanguageTag(langTag.asLiteral().getString())); } } finally { it.close(); } } return languages; }
Example 2
Source File: AbstractShapeListConstraintExecutor.java From shacl with Apache License 2.0 | 4 votes |
AbstractShapeListConstraintExecutor(Constraint constraint) { RDFList list = constraint.getParameterValue().as(RDFList.class); ExtendedIterator<RDFNode> sit = list.iterator(); shapes = sit.mapWith(n -> n.asResource()).toList(); }