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

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

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

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

Iterator<Triple> resultTripleIterator = resultGraph.filter(FIELD_QUERY_RESULT_SET,
  FIELD_QUERY_RESULT, null);
Iterator<RdfRepresentation> resultIterator = new AdaptingIterator<Triple,RdfRepresentation>(
    resultTripleIterator, new AdaptingIterator.Adapter<Triple,RdfRepresentation>() {
origin: apache/stanbol

@Override
public final A next() {
  hasNext(); //call hasNext (to init next Element if not already done)
  if(!hasNext){
    throw new NoSuchElementException();
  } else {
    A current = next;
    next = null;
    hasNext = null;
    return current;
  }
}
/**
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

@Override
public final boolean hasNext() {
  if(hasNext == null){ // only once even with multiple calls
    next = prepareNext();
    hasNext = next != null;
  }
  return hasNext;
}
origin: apache/stanbol

Iterator<Triple> resultTripleIterator = resultGraph.filter(FIELD_QUERY_RESULT_SET,
  FIELD_QUERY_RESULT, null);
Iterator<RdfRepresentation> resultIterator = new AdaptingIterator<Triple,RdfRepresentation>(
    resultTripleIterator, new AdaptingIterator.Adapter<Triple,RdfRepresentation>() {
origin: apache/stanbol

@Override
public final boolean hasNext() {
  if(hasNext == null){ // only once even with multiple calls
    next = prepareNext();
    hasNext = next != null;
  }
  return hasNext;
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

@Override
public final A next() {
  hasNext(); //call hasNext (to init next Element if not already done)
  if(!hasNext){
    throw new NoSuchElementException();
  } else {
    A current = next;
    next = null;
    hasNext = null;
    return current;
  }
}
/**
origin: apache/stanbol

@Override
public Iterator<Text> getText(String field) {
  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");
  }
  return new AdaptingIterator<Literal, Text>(
      graphNode.getLiterals(new IRI(field)),
      new Literal2TextAdapter<Literal>(),
      Text.class);
}
origin: apache/stanbol

@Override
public Iterator<Object> get(String field) {
  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");
  }
  return new AdaptingIterator<RDFTerm, Object>(graphNode.getObjects(new IRI(field)),
      new Resource2ValueAdapter<RDFTerm>(),Object.class);
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.clerezza

@Override
public Iterator<Reference> getReferences(String field) {
  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");
  }
  return new AdaptingIterator<IRI,Reference>(
      graphNode.getIRIObjects(new IRI(field)),
      new IRI2ReferenceAdapter(),Reference.class);
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.clerezza

@Override
public Iterator<Object> get(String field) {
  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");
  }
  return new AdaptingIterator<RDFTerm, Object>(graphNode.getObjects(new IRI(field)),
      new Resource2ValueAdapter<RDFTerm>(),Object.class);
}
origin: apache/stanbol

@Override
public Iterator<Reference> getReferences(String field) {
  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");
  }
  return new AdaptingIterator<IRI,Reference>(
      graphNode.getIRIObjects(new IRI(field)),
      new IRI2ReferenceAdapter(),Reference.class);
}
origin: apache/stanbol

@Override
public Iterator<Text> get(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");
  }
  return new AdaptingIterator<Literal, Text>(
      graphNode.getLiterals(new IRI(field)),
      new Literal2TextAdapter<Literal>(languages),
      Text.class);
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.clerezza

@Override
public Iterator<Text> getText(String field) {
  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");
  }
  return new AdaptingIterator<Literal, Text>(
      graphNode.getLiterals(new IRI(field)),
      new Literal2TextAdapter<Literal>(),
      Text.class);
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.clerezza

@Override
public Iterator<Text> get(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");
  }
  return new AdaptingIterator<Literal, Text>(
      graphNode.getLiterals(new IRI(field)),
      new Literal2TextAdapter<Literal>(languages),
      Text.class);
}
origin: apache/stanbol

@Override
public Iterator<String> getFieldNames() {
  return new AdaptingIterator<IRI, String>(graphNode.getProperties(),
      new Resource2StringAdapter<IRI>(), String.class);
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.clerezza

@Override
public Iterator<String> getFieldNames() {
  return new AdaptingIterator<IRI, String>(graphNode.getProperties(),
      new Resource2StringAdapter<IRI>(), String.class);
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.clerezza

  return new AdaptingIterator<IRI, T>(
      graphNode.getIRIObjects(fieldIRI),
      new IRIAdapter<T>(),
      type);
} else if(Reference.class.isAssignableFrom(type)){
  return (Iterator<T>) new AdaptingIterator<IRI,Reference>(
      graphNode.getIRIObjects(fieldIRI),
      new IRI2ReferenceAdapter(),Reference.class);
} else if(Text.class.isAssignableFrom(type)){
  return (Iterator<T>)new AdaptingIterator<Literal, Text>(
      graphNode.getLiterals(fieldIRI),
      new Literal2TextAdapter<Literal>(),
      Text.class);
} else { //support for Literals -> Type conversions
  return new AdaptingIterator<Literal, T>(
      graphNode.getLiterals(fieldIRI),
      new LiteralAdapter<Literal, T>(),
origin: apache/stanbol

resultIt = new AdaptingIterator<Entity,Representation>(site.findEntities(query).iterator(),
    new AdaptingIterator.Adapter<Entity,Representation>() {
      @Override
origin: apache/stanbol

Iterator<Representation> representationIterator = new AdaptingIterator<SolutionMapping, Representation>(
    result, new AdaptingIterator.Adapter<SolutionMapping, Representation>() {
origin: apache/stanbol

  return new AdaptingIterator<IRI, T>(
      graphNode.getIRIObjects(fieldIRI),
      new IRIAdapter<T>(),
      type);
} else if(Reference.class.isAssignableFrom(type)){
  return (Iterator<T>) new AdaptingIterator<IRI,Reference>(
      graphNode.getIRIObjects(fieldIRI),
      new IRI2ReferenceAdapter(),Reference.class);
} else if(Text.class.isAssignableFrom(type)){
  return (Iterator<T>)new AdaptingIterator<Literal, Text>(
      graphNode.getLiterals(fieldIRI),
      new Literal2TextAdapter<Literal>(),
      Text.class);
} else { //support for Literals -> Type conversions
  return new AdaptingIterator<Literal, T>(
      graphNode.getLiterals(fieldIRI),
      new LiteralAdapter<Literal, T>(),
org.apache.stanbol.entityhub.servicesapi.utilAdaptingIterator

Javadoc

Uses the parsed Adapter to convert values of type T to values of type A. If an instance of T can not be converted to A, than such values are filtered. This means that this implementation can be used for both filtering and converting of values of the base iterator. In fact the FilteringIterator is implemented based on this class.

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.

Most used methods

  • <init>
    Constructs an instance based on an iterator of type T, an adapter and the target type
  • hasNext
  • prepareNext

Popular in Java

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Path (java.nio.file)
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm plugins
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