@Test void testGetAttributeIdentifiers() { EntityType sourceEntityType = entityTypeFactory.create("sourceEntityType"); Entity entityTypeEntity = mock(Entity.class); when(dataService.findOne( ENTITY_TYPE_META_DATA, new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId()))) .thenReturn(entityTypeEntity); Attribute attributeEntity1 = attrMetaFactory.create(); attributeEntity1.setIdentifier("1"); attributeEntity1.setDataType(STRING); Attribute attributeEntity2 = attrMetaFactory.create(); attributeEntity2.setIdentifier("2"); attributeEntity2.setDataType(STRING); when(entityTypeEntity.getEntities(EntityTypeMetadata.ATTRIBUTES)) .thenReturn(asList(attributeEntity1, attributeEntity2)); List<String> expactedAttributeIdentifiers = asList("1", "2"); assertEquals( expactedAttributeIdentifiers, semanticSearchServiceHelper.getAttributeIdentifiers(sourceEntityType)); }
public List<String> getAttributeIdentifiers(EntityType sourceEntityType) { Entity entityTypeEntity = dataService.findOne( ENTITY_TYPE_META_DATA, new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId())); if (entityTypeEntity == null) throw new MolgenisDataAccessException( "Could not find EntityTypeEntity by the name of " + sourceEntityType.getId()); List<String> attributeIdentifiers = new ArrayList<>(); recursivelyCollectAttributeIdentifiers( entityTypeEntity.getEntities(EntityTypeMetadata.ATTRIBUTES), attributeIdentifiers); return attributeIdentifiers; }
SemanticSearchServiceHelper { public List<String> getAttributeIdentifiers(EntityType sourceEntityType) { Entity entityTypeEntity = dataService.findOne( ENTITY_TYPE_META_DATA, new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId())); if (entityTypeEntity == null) throw new MolgenisDataAccessException( "Could not find EntityTypeEntity by the name of " + sourceEntityType.getId()); List<String> attributeIdentifiers = new ArrayList<>(); recursivelyCollectAttributeIdentifiers( entityTypeEntity.getEntities(EntityTypeMetadata.ATTRIBUTES), attributeIdentifiers); return attributeIdentifiers; } }
SemanticSearchServiceHelper { public List<String> getAttributeIdentifiers(EntityType sourceEntityType) { Entity entityTypeEntity = dataService.findOne( ENTITY_TYPE_META_DATA, new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId())); if (entityTypeEntity == null) throw new MolgenisDataAccessException( "Could not find EntityTypeEntity by the name of " + sourceEntityType.getId()); List<String> attributeIdentifiers = new ArrayList<>(); recursivelyCollectAttributeIdentifiers( entityTypeEntity.getEntities(EntityTypeMetadata.ATTRIBUTES), attributeIdentifiers); return attributeIdentifiers; } SemanticSearchServiceHelper(
      DataService dataService,
      OntologyService ontologyService,
      TermFrequencyService termFrequencyService); }
SemanticSearchServiceHelper { public List<String> getAttributeIdentifiers(EntityType sourceEntityType) { Entity entityTypeEntity = dataService.findOne( ENTITY_TYPE_META_DATA, new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId())); if (entityTypeEntity == null) throw new MolgenisDataAccessException( "Could not find EntityTypeEntity by the name of " + sourceEntityType.getId()); List<String> attributeIdentifiers = new ArrayList<>(); recursivelyCollectAttributeIdentifiers( entityTypeEntity.getEntities(EntityTypeMetadata.ATTRIBUTES), attributeIdentifiers); return attributeIdentifiers; } SemanticSearchServiceHelper(
      DataService dataService,
      OntologyService ontologyService,
      TermFrequencyService termFrequencyService); QueryRule createDisMaxQueryRuleForAttribute(
      Set<String> searchTerms, Collection<OntologyTerm> ontologyTerms); QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms); QueryRule createBoostedDisMaxQueryRuleForTerms(
      List<String> queryTerms, Double boostValue); QueryRule createShouldQueryRule(String multiOntologyTermIri); List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm); Set<String> getOtLabelAndSynonyms(OntologyTerm ontologyTerm); Map<String, String> collectExpandedQueryMap(
      Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms); void collectOntologyTermQueryMap(
      Map<String, String> expanedQueryMap, OntologyTerm ontologyTerm); List<String> getAttributeIdentifiers(EntityType sourceEntityType); List<OntologyTerm> findTags(String description, List<String> ontologyIds); String processQueryString(String queryString); String parseBoostQueryString(String queryString, double boost); String escapeCharsExcludingCaretChar(String string); Set<String> removeStopWords(String description); }
SemanticSearchServiceHelper { public List<String> getAttributeIdentifiers(EntityType sourceEntityType) { Entity entityTypeEntity = dataService.findOne( ENTITY_TYPE_META_DATA, new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId())); if (entityTypeEntity == null) throw new MolgenisDataAccessException( "Could not find EntityTypeEntity by the name of " + sourceEntityType.getId()); List<String> attributeIdentifiers = new ArrayList<>(); recursivelyCollectAttributeIdentifiers( entityTypeEntity.getEntities(EntityTypeMetadata.ATTRIBUTES), attributeIdentifiers); return attributeIdentifiers; } SemanticSearchServiceHelper(
      DataService dataService,
      OntologyService ontologyService,
      TermFrequencyService termFrequencyService); QueryRule createDisMaxQueryRuleForAttribute(
      Set<String> searchTerms, Collection<OntologyTerm> ontologyTerms); QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms); QueryRule createBoostedDisMaxQueryRuleForTerms(
      List<String> queryTerms, Double boostValue); QueryRule createShouldQueryRule(String multiOntologyTermIri); List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm); Set<String> getOtLabelAndSynonyms(OntologyTerm ontologyTerm); Map<String, String> collectExpandedQueryMap(
      Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms); void collectOntologyTermQueryMap(
      Map<String, String> expanedQueryMap, OntologyTerm ontologyTerm); List<String> getAttributeIdentifiers(EntityType sourceEntityType); List<OntologyTerm> findTags(String description, List<String> ontologyIds); String processQueryString(String queryString); String parseBoostQueryString(String queryString, double boost); String escapeCharsExcludingCaretChar(String string); Set<String> removeStopWords(String description); static final int MAX_NUM_TAGS; }