use of org.apache.stanbol.entityhub.servicesapi.util.FilteringIterator in project stanbol by apache.
the class RdfRepresentation method removeAllNaturalText.
@Override
public void removeAllNaturalText(String field, String... languages) {
if (field == null) {
throw new IllegalArgumentException("The parsed field MUST NOT be NULL");
} else if (field.isEmpty()) {
throw new IllegalArgumentException("The parsed field MUST NOT be Empty");
}
// if(languages == null || languages.length == 0){
// languages = new String []{null};
// }
IRI fieldIRI = new IRI(field);
//get all the affected Literals
Collection<Literal> toRemove = new ArrayList<Literal>();
Iterator<Literal> it = new FilteringIterator<Literal>(graphNode.getLiterals(fieldIRI), new NaturalTextFilter(languages), Literal.class);
while (it.hasNext()) {
toRemove.add(it.next());
}
for (Literal l : toRemove) {
graphNode.deleteProperty(fieldIRI, l);
}
}
Aggregations