예제 #1
0
 private List<String> getMatchingAnnotations(String name, CSVEntry csvEntry) {
   for (String annotation : csvEntry.getAnnotations()) {
     if (annotation.equals(name)) {
       return Collections.singletonList(name);
     }
   }
   return csvEntry.getAnnotations();
 }
예제 #2
0
 private List<Thing> processDescription(CSVEntry csvEntry) {
   if (alreadyExistingElements.containsKey(csvEntry.getDescription())) {
     return Collections.emptyList();
   }
   Thing parent = getParent(csvEntry);
   Thing entity = new Entity(parent, csvEntry.getDescription(), csvEntry.getAnnotations());
   alreadyExistingElements.put(csvEntry.getDescription(), entity);
   return Collections.singletonList(entity);
 }
예제 #3
0
 private Thing getParentFromPreposition(CSVEntry csvEntry) {
   if ("text".equals(csvEntry.getNature())) {
     return new Entity("text");
   } else {
     return new Entity(classesEntity, "ideograph", Collections.emptyList());
   }
 }
예제 #4
0
 private List<Thing> processCompoundWords(CSVEntry csvEntry) {
   String description = csvEntry.getDescription();
   if (hasPreposition(description)) {
     return handlePrepositions(csvEntry);
   } else {
     return processIndividualWords(description, csvEntry);
   }
 }
예제 #5
0
 private List<Thing> handleElementOfPreposition(String key, CSVEntry csvEntry) {
   if (alreadyExistingElements.containsKey(key)) {
     return Collections.emptyList();
   }
   Thing possibleParent = getParentFromIndividualWords(key);
   Thing entity = new Entity(possibleParent, key, csvEntry.getAnnotations());
   alreadyExistingElements.put(key, entity);
   return Collections.singletonList(entity);
 }
예제 #6
0
 private List<Thing> processAnnotations(CSVEntry csvEntry) {
   List<Thing> newAnnotations = new ArrayList<>();
   for (String annotation : csvEntry.getAnnotations()) {
     if (alreadyExistingElements.containsKey(getAnnotationName(annotation))) {
       continue;
     }
     Thing newAnnotation = new Annotation(annotationEntity, annotation);
     newAnnotations.add(newAnnotation);
     alreadyExistingElements.put(getAnnotationName(annotation), newAnnotation);
   }
   return newAnnotations;
 }
예제 #7
0
 private List<Thing> processSpecialCases(CSVEntry csvEntry) {
   Thing parent = getParentFromPreposition(csvEntry);
   Thing subClasses = new Entity(parent, csvEntry.getDescription(), csvEntry.getAnnotations());
   alreadyExistingElements.put(csvEntry.getDescription(), subClasses);
   return Arrays.asList(parent, subClasses);
 }
예제 #8
0
 private boolean descriptionNeedsSpecialHandling(CSVEntry nature) {
   return "text".equals(nature.getNature()) || nature.getDescription().contains("ideograph");
 }
예제 #9
0
 private Thing getParent(CSVEntry csvEntry) {
   if (hasPreposition(csvEntry.getDescription())) {
     return getParentFromPreposition(getLeftHandSideOfPreposition());
   }
   return getParentUsingFullDescription(csvEntry.getDescription());
 }