congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
FilteringIterator
Code IndexAdd Tabnine to your IDE (free)

How to use
FilteringIterator
in
org.apache.stanbol.entityhub.servicesapi.util

Best Java code snippets using org.apache.stanbol.entityhub.servicesapi.util.FilteringIterator (Showing top 2 results out of 315)

origin: apache/stanbol

  @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);
    }
  }

origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.clerezza

  @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);
    }
  }

org.apache.stanbol.entityhub.servicesapi.utilFilteringIterator

Javadoc

Implementation of an Iterator that iterates over a filtered set of elements of its parent Iterator.

Note that Iterator#remove() only works as long as Iterator#hasNext() was not called to determine if there are further elements. The reason for that is, that in order to filter elements of the parent iterator Iterator#next() has to be called to check weather any further element is valid against the used Filter. This call to Iterator#next() causes the parent Iterator to switch to the next element, meaning that after that the remove() method would delete a different element. To avoid that this Iterator throws an IllegalStateException in such cases. If the parent Iterator does not support remove() at all an UnsupportedOperationException is thrown.

This implementation is based on the AdaptingIterator to avoid duplication of the filtering functionality also needed if an adapter can not convert a specific value of one type to an other.

Most used methods

  • <init>

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now