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

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

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

origin: apache/stanbol

Representation data;
Representation metadata = null;
String entityId = ModelUtils.getAboutRepresentation(rep);
if(entityId != null){
  data = entityhubYard.getRepresentation(entityId);
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

/**
 * Checks if the parsed Entity can be wrapped as a locally managed entity.
 * This checks currently of a {@link ManagedEntityState} is defined by the
 * metadata.
 * @param entity the entity to check
 * @return the state
 */
public static boolean canWrap(Entity entity) {
  //check the metadata for
  //if the entity is managed locally
  //if the entity has an state
  Reference stateUri = entity.getMetadata().getFirstReference(STATE);
  if(stateUri == null ||
      !ManagedEntityState.isState(stateUri.getReference())){
    return false;
  }
  //check the about
  String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
  if(entityId == null || !entityId.equals(entity.getRepresentation().getId())){
    return false;
  }
  return true;
}
/**
origin: apache/stanbol

/**
 * Checks if the parsed Entity can be wrapped as a locally managed entity.
 * This checks currently of a {@link ManagedEntityState} is defined by the
 * metadata.
 * @param entity the entity to check
 * @return the state
 */
public static boolean canWrap(Entity entity) {
  //check the metadata for
  //if the entity is managed locally
  //if the entity has an state
  Reference stateUri = entity.getMetadata().getFirstReference(STATE);
  if(stateUri == null ||
      !ManagedEntityState.isState(stateUri.getReference())){
    return false;
  }
  //check the about
  String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
  if(entityId == null || !entityId.equals(entity.getRepresentation().getId())){
    return false;
  }
  return true;
}
/**
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

Representation data;
Representation metadata = null;
String entityId = ModelUtils.getAboutRepresentation(rep);
if(entityId != null){
  data = entityhubYard.getRepresentation(entityId);
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

/**
 * Sets the parsed default state to the metadata if no other one is already
 * present and that wraps the entity as locally managed entity.
 * @param entity the entity
 * @param defaultState the default state used if no one is yet defined for
 * this entity
 * @return the wrapped entity
 */
public static ManagedEntity init(Entity entity, ManagedEntityState defaultState){
  Reference stateUri = entity.getMetadata().getFirstReference(STATE);
  if(stateUri == null ||
      !ManagedEntityState.isState(stateUri.getReference())){
    entity.getMetadata().setReference(STATE, defaultState.getUri());
  }
  String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
  if(entityId == null){
    entity.getMetadata().setReference(
      RdfResourceEnum.aboutRepresentation.getUri(), 
      entity.getRepresentation().getId());
  } else if(!entityId.equals(entity.getRepresentation().getId())){
    //the metadata are about a different Entity ->
    throw new IllegalArgumentException(String.format(
      "The Metadata of the parsed Entity are not about the Entity ("+
      "entity: %s | metadataId: %s | metadataAbout: %s)",
      entity.getRepresentation().getId(),entity.getMetadata().getId(),
      entityId));
  }//else the ID value is OK
  return new ManagedEntity(entity,false);
}
origin: apache/stanbol

/**
 * Sets the parsed default state to the metadata if no other one is already
 * present and that wraps the entity as locally managed entity.
 * @param entity the entity
 * @param defaultState the default state used if no one is yet defined for
 * this entity
 * @return the wrapped entity
 */
public static ManagedEntity init(Entity entity, ManagedEntityState defaultState){
  Reference stateUri = entity.getMetadata().getFirstReference(STATE);
  if(stateUri == null ||
      !ManagedEntityState.isState(stateUri.getReference())){
    entity.getMetadata().setReference(STATE, defaultState.getUri());
  }
  String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
  if(entityId == null){
    entity.getMetadata().setReference(
      RdfResourceEnum.aboutRepresentation.getUri(), 
      entity.getRepresentation().getId());
  } else if(!entityId.equals(entity.getRepresentation().getId())){
    //the metadata are about a different Entity ->
    throw new IllegalArgumentException(String.format(
      "The Metadata of the parsed Entity are not about the Entity ("+
      "entity: %s | metadataId: %s | metadataAbout: %s)",
      entity.getRepresentation().getId(),entity.getMetadata().getId(),
      entityId));
  }//else the ID value is OK
  return new ManagedEntity(entity,false);
}
org.apache.stanbol.entityhub.servicesapi.utilModelUtilsgetAboutRepresentation

Javadoc

Getter for the id of the Entity the parsed Representationare RdfResourceEnum#aboutRepresentation.

Popular methods of ModelUtils

  • asCollection
    Copies all elements of the parsed Iterator to a ArrayList. To use other Set implementations that Arr
  • 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
  • randomUUID
    TODO: Maybe we need a better way to generate unique IDs

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JPanel (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • 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