Tabnine Logo
ModelUtils.asCollection
Code IndexAdd Tabnine to your IDE (free)

How to use
asCollection
method
in
org.apache.stanbol.entityhub.servicesapi.util.ModelUtils

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

origin: apache/stanbol

  results = ModelUtils.asCollection(r.get(property.toString()));
} else {
  results = new LinkedHashSet<Object>();
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

/**
 * Getter for the id of the Entity the parsed {@link Representation metadata}
 * are {@link RdfResourceEnum#aboutRepresentation about}.
 * @param metadata the metadata
 * @return the id of the entity or <code>null</code> if the parsed {@link Representation}
 * is <code>null</code> or does not define a value for 
 * {@link RdfResourceEnum#aboutRepresentation}
 */
public static String getAboutRepresentation(Representation metadata) throws IllegalStateException{
  if(metadata == null){
    return null;
  }
  Iterator<Reference> refs = metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri());
  if(refs.hasNext()){
    Reference about = refs.next();
    if(refs.hasNext()){
      log.warn("The parsed Representation {} claims to be the metadata of" +
        "multiple Entities (entities: {})", 
        metadata.getId(),
        asCollection(metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri())));
    }
    return about.getReference();
  } else {
    return null;
  }
}

origin: apache/stanbol

/**
 * Getter for the id of the Entity the parsed {@link Representation metadata}
 * are {@link RdfResourceEnum#aboutRepresentation about}.
 * @param metadata the metadata
 * @return the id of the entity or <code>null</code> if the parsed {@link Representation}
 * is <code>null</code> or does not define a value for 
 * {@link RdfResourceEnum#aboutRepresentation}
 */
public static String getAboutRepresentation(Representation metadata) throws IllegalStateException{
  if(metadata == null){
    return null;
  }
  Iterator<Reference> refs = metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri());
  if(refs.hasNext()){
    Reference about = refs.next();
    if(refs.hasNext()){
      log.warn("The parsed Representation {} claims to be the metadata of" +
        "multiple Entities (entities: {})", 
        metadata.getId(),
        asCollection(metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri())));
    }
    return about.getReference();
  } else {
    return null;
  }
}

origin: apache/stanbol

private void deleteMappingsbyTarget(String id) throws YardException {
  if(id != null && !id.isEmpty()){
    FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
    fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(id));
    deleteEntities(ModelUtils.asCollection(
      entityhubYard.findReferences(fieldQuery).iterator()));
  }
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

private void deleteMappingsbyTarget(String id) throws YardException {
  if(id != null && !id.isEmpty()){
    FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
    fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(id));
    deleteEntities(ModelUtils.asCollection(
      entityhubYard.findReferences(fieldQuery).iterator()));
  }
}
origin: apache/stanbol

Iterator<Reference> types = r.getReferences(TYPE_FIELD);
if(types != null && types.hasNext()) {
  jResult.put("type", new JSONArray(ModelUtils.asCollection(types)));
org.apache.stanbol.entityhub.servicesapi.utilModelUtilsasCollection

Javadoc

Copies all elements of the parsed Iterator to a ArrayList. To use other Set implementations that ArrayList you can use #addToCollection(Iterator,Collection)

Popular methods of ModelUtils

  • checkValues
    Processes a value parsed as object to the representation. This processing includes: * Removal of nu
  • getRepresentationInfo
    String representation of the parsed Representation inteded for DEBUG level loggings.
  • addToCollection
    Adds the elements of the Iterator to the parsed Collection
  • getNamespaceLocalName
    Splits up a URI in local name and namespace based on the following rules * If URI starts with "u
  • asSet
    Copies all elements of the parsed Iterator to a HashSet. To use other Set implementations that HashS
  • addToSet
    Adds the elements of the Iterator to the parsed Set
  • getAboutRepresentation
    Getter for the id of the Entity the parsed Representationare RdfResourceEnum#aboutRepresentation.
  • randomUUID
    TODO: Maybe we need a better way to generate unique IDs

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • String (java.lang)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Reference (javax.naming)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best IntelliJ 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