congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
TypeUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
TypeUtils
in
uk.gov.dstl.baleen.uima.utils

Best Java code snippets using uk.gov.dstl.baleen.uima.utils.TypeUtils (Showing top 20 results out of 315)

origin: dstl/baleen

 @SuppressWarnings("unchecked")
 private Collection<Class<? extends BaleenAnnotation>> createList(Collection<String> types) {
  Collection<Class<? extends BaleenAnnotation>> list = new ArrayList<>();
  for (String type : types) {
   list.add((Class<? extends BaleenAnnotation>) TypeUtils.getType(type, jCas));
  }
  return list;
 }
}
origin: uk.gov.dstl.baleen/baleen-uima

/**
 * Get the given structure classes from by name or return all classes if null or empty
 *
 * @param typeNames the types to get
 * @return the structure classes
 * @throws ResourceInitializationException
 */
public static Set<Class<? extends Structure>> getStructureClasses(String... typeNames)
  throws ResourceInitializationException {
 return TypeUtils.getTypeClasses(Structure.class, typeNames);
}
origin: dstl/baleen

/**
 * Build the structure hierarchy, by first collecting all the annotations.
 *
 * @param jCas the jCas
 * @param annotationTypes the annotations classes to use
 * @return the root structure node
 */
protected static <T extends Annotation> Node<T> buildRoot(
  JCas jCas, Set<Class<? extends T>> annotationTypes) {
 return build(
   TypeUtils.filterAnnotations(
     JCasUtil.select(jCas, BaleenAnnotation.class), annotationTypes));
}
origin: uk.gov.dstl.baleen/baleen-graph

 /** @return the build {@link EntityGraphOptions} */
 public EntityGraphOptions build() {
  if (typeClasses == null) {
   typeClasses = TypeUtils.getAnnotationClasses(Entity.class);
  }
  ValueStrategyProvider valueStrategyProvider =
    key -> valueStrategies.getOrDefault(key, defaultValueStrategy);
  return new EntityGraphOptions(
    contentHashAsId,
    outputEvents,
    multiValueProperties,
    ImmutableSet.copyOf(stopFeatures),
    typeClasses,
    valueStrategyProvider,
    ImmutableList.copyOf(aggregateProperties),
    valueCoercer);
 }
}
origin: dstl/baleen

@Test
public void testTemporalEntity() throws UIMAException, BaleenException {
 JCas jCas = JCasSingleton.getJCasInstance();
 Class<? extends Entity> c = TypeUtils.getEntityClass("Temporal", jCas);
 assertEquals(Temporal.class, c);
}
origin: uk.gov.dstl.baleen/baleen-uima

Class<AnnotationBase> ret = getClassFromType("." + typeName, types);
if (ret == null) {
 ret = getClassFromType(typeName, types);
origin: dstl/baleen

 /** @return the build {@link EntityGraphOptions} */
 public EntityGraphOptions build() {
  if (typeClasses == null) {
   typeClasses = TypeUtils.getAnnotationClasses(Entity.class);
  }
  ValueStrategyProvider valueStrategyProvider =
    key -> valueStrategies.getOrDefault(key, defaultValueStrategy);
  return new EntityGraphOptions(
    contentHashAsId,
    outputEvents,
    multiValueProperties,
    ImmutableSet.copyOf(stopFeatures),
    typeClasses,
    valueStrategyProvider,
    ImmutableList.copyOf(aggregateProperties),
    valueCoercer);
 }
}
origin: dstl/baleen

@Test
public void testRelationEntity() throws UIMAException {
 JCas jCas = JCasSingleton.getJCasInstance();
 try {
  TypeUtils.getEntityClass("Relation", jCas);
  fail("Expected exception not found");
 } catch (BaleenException e) {
  // Do nothing - exception expected
 }
}
origin: dstl/baleen

Class<AnnotationBase> ret = getClassFromType("." + typeName, types);
if (ret == null) {
 ret = getClassFromType(typeName, types);
origin: dstl/baleen

/**
 * For a given type name, look through the type system and return the matching class. If two types
 * of the same name (but different packages) exist, then null will be returned and the package
 * will need to be included in the typeName.
 *
 * @param typeName The name of the type, optionally including the package
 * @param jCas A JCas object containing the type system
 * @return The class associated with that type
 */
public static Class<? extends AnnotationBase> getType(String typeName, JCas jCas) {
 return getType(typeName, jCas.getTypeSystem());
}
origin: dstl/baleen

/**
 * Get the given structure classes from by name or return all classes if null or empty
 *
 * @param typeNames the types to get
 * @return the structure classes
 * @throws ResourceInitializationException
 */
public static Set<Class<? extends Structure>> getStructureClasses(String... typeNames)
  throws ResourceInitializationException {
 return TypeUtils.getTypeClasses(Structure.class, typeNames);
}
origin: uk.gov.dstl.baleen/baleen-uima

/**
 * Build the structure hierarchy, by first collecting all the annotations.
 *
 * @param jCas the jCas
 * @param annotationTypes the annotations classes to use
 * @return the root structure node
 */
protected static <T extends Annotation> Node<T> buildRoot(
  JCas jCas, Set<Class<? extends T>> annotationTypes) {
 return build(
   TypeUtils.filterAnnotations(
     JCasUtil.select(jCas, BaleenAnnotation.class), annotationTypes));
}
origin: dstl/baleen

 /** @return the build {@link DocumentGraphOptions} */
 public DocumentGraphOptions build() {
  if (typeClasses == null) {
   typeClasses = TypeUtils.getAnnotationClasses(Entity.class);
  }
  return new DocumentGraphOptions(
    contentHashAsId,
    outputMeta,
    outputContent,
    outputDocument,
    outputReferents,
    outputRelations,
    outputRelationsAsLinks,
    outputEvents,
    ImmutableSet.copyOf(typeClasses),
    ImmutableSet.copyOf(stopFeatures),
    valueCoercer);
 }
}
origin: dstl/baleen

@Test
public void testPersonEntity() throws UIMAException, BaleenException {
 JCas jCas = JCasSingleton.getJCasInstance();
 Class<? extends Entity> c = TypeUtils.getEntityClass("Person", jCas);
 assertEquals(Person.class, c);
}
origin: uk.gov.dstl.baleen/baleen-uima

/**
 * For a given type name, look through the type system and return the matching class. If two types
 * of the same name (but different packages) exist, then null will be returned and the package
 * will need to be included in the typeName.
 *
 * @param typeName The name of the type, optionally including the package
 * @param jCas A JCas object containing the type system
 * @return The class associated with that type
 */
public static Class<? extends AnnotationBase> getType(String typeName, JCas jCas) {
 return getType(typeName, jCas.getTypeSystem());
}
origin: dstl/baleen

 @Test
 public void testCanGetTypeClass() throws ResourceInitializationException {
  Set<Class<? extends Entity>> typeClasses =
    TypeUtils.getTypeClasses(Entity.class, new String[] {Person.class.getSimpleName()});
  assertEquals(1, typeClasses.size());
  assertTrue(typeClasses.contains(Person.class));
 }
}
origin: uk.gov.dstl.baleen/baleen-uima

 /**
  * Build the covering index of baleen annotations by structure annotations (lazily) filtered to
  * only the given structural classes
  *
  * @param jCas the jCas
  * @param structuralClasses the structural classes
  * @return the covering index
  */
 private static Map<Annotation, Collection<Structure>> buildCovering(
   JCas jCas, Set<Class<? extends Structure>> structuralClasses) {
  return Maps.transformValues(
    JCasUtil.indexCovering(jCas, BaleenAnnotation.class, Structure.class),
    s -> TypeUtils.filterAnnotations(s, structuralClasses));
 }
}
origin: uk.gov.dstl.baleen/baleen-graph

 /** @return the build {@link DocumentGraphOptions} */
 public DocumentGraphOptions build() {
  if (typeClasses == null) {
   typeClasses = TypeUtils.getAnnotationClasses(Entity.class);
  }
  return new DocumentGraphOptions(
    contentHashAsId,
    outputMeta,
    outputContent,
    outputDocument,
    outputReferents,
    outputRelations,
    outputRelationsAsLinks,
    outputEvents,
    ImmutableSet.copyOf(typeClasses),
    ImmutableSet.copyOf(stopFeatures),
    valueCoercer);
 }
}
origin: dstl/baleen

@Test
public void testMissingEntity() throws UIMAException {
 JCas jCas = JCasSingleton.getJCasInstance();
 try {
  TypeUtils.getEntityClass("Missing", jCas);
  fail("Expected exception not found");
 } catch (BaleenException e) {
  // Do nothing - exception expected
 }
}
origin: uk.gov.dstl.baleen/baleen-rdf

private Type getType(String typeName) {
 Class<AnnotationBase> typeClass = TypeUtils.getType(typeName, typeSystem);
 return typeSystem.getType(typeClass.getCanonicalName());
}
uk.gov.dstl.baleen.uima.utilsTypeUtils

Javadoc

A collection of utility to set bridge between Uima types and Java classes.

Most used methods

  • getType
    For a given type name, look through the type system and return the matching class. If two types of t
  • getTypeClasses
    Get the given type classes by name or return all classes if null or empty
  • filterAnnotations
    Filter the given annotations to only those contained in the given set
  • getAnnotationClasses
    Get the sub types of the given baleen annotation type
  • getClassFromType
  • getEntityClass
    Get the class of a specified type, that extends from the Entity base class

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JLabel (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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