本文整理了Java中org.molgenis.data.Entity.getEntities()
方法的一些代码示例,展示了Entity.getEntities()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getEntities()
方法的具体详情如下:
包路径:org.molgenis.data.Entity
类名称:Entity
方法名:getEntities
暂无
代码示例来源:origin: org.molgenis/molgenis-data-icd10
@Override
public Iterable<Entity> children(@Nonnull Entity diseaseClassEntity) {
return diseaseClassEntity.getEntities(DISEASE_CLASS_CHILDREN_ATTRIBUTE_NAME);
}
}
代码示例来源:origin: org.molgenis/molgenis-ontology-core
private boolean qualifiedNodePath(String nodePath, Entity entity) {
Iterable<Entity> nodePathEntities =
entity.getEntities(OntologyTermMetaData.ONTOLOGY_TERM_NODE_PATH);
return Lists.newArrayList(nodePathEntities)
.stream()
.anyMatch(
nodePathEntity -> {
String childNodePath =
nodePathEntity.getString(OntologyTermNodePathMetaData.NODE_PATH);
return !StringUtils.equals(nodePath, childNodePath)
&& childNodePath.startsWith(nodePath);
});
}
代码示例来源:origin: org.molgenis/molgenis-settings
@Override
public Iterable<Entity> getEntities(String attributeName) {
return getEntity().getEntities(attributeName);
}
代码示例来源:origin: org.molgenis/molgenis-settings
@Override
public <E extends Entity> Iterable<E> getEntities(String attributeName, Class<E> clazz) {
return getEntity().getEntities(attributeName, clazz);
}
代码示例来源:origin: org.molgenis/molgenis-data-semanticsearch
private Entity findAttributeEntity(EntityType entityType, String attributeName)
{
Entity entityTypeEntity = dataService.findOneById(ENTITY_TYPE_META_DATA, entityType.getId());
Optional<Entity> result = stream(entityTypeEntity.getEntities(ATTRIBUTES).spliterator(), false)
.filter(att -> attributeName.equals(att.getString(AttributeMetadata.NAME))).findFirst();
return result.isPresent() ? result.get() : null;
}
代码示例来源:origin: org.molgenis/molgenis-navigator
@Override
public Iterable<Entity> getEntities(String attributeName) {
return stream(delegate().getEntities(attributeName))
.map(this::newPretendingEntity)
.collect(toList());
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
private Entity findAttributeEntity(EntityType entityType, String attributeName) {
Entity entityTypeEntity = dataService.findOneById(ENTITY_TYPE_META_DATA, entityType.getId());
Optional<Entity> result =
stream(entityTypeEntity.getEntities(ATTRIBUTES).spliterator(), false)
.filter(att -> attributeName.equals(att.getString(AttributeMetadata.NAME)))
.findFirst();
return result.orElse(null);
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
private void recursivelyCollectAttributeIdentifiers(
Iterable<Entity> attributeEntities, List<String> attributeIdentifiers) {
for (Entity attributeEntity : attributeEntities) {
if (!attributeEntity.getString(AttributeMetadata.TYPE).equals(COMPOUND.toString())) {
attributeIdentifiers.add(attributeEntity.getString(AttributeMetadata.ID));
}
Iterable<Entity> entities = attributeEntity.getEntities(AttributeMetadata.CHILDREN);
if (entities != null) {
recursivelyCollectAttributeIdentifiers(entities, attributeIdentifiers);
}
}
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
@Override
public void removeAttributeTag(
String entity, String attribute, String relationIRI, String ontologyTermIRI) {
Entity attributeEntity = findAttributeEntity(entity, attribute);
Iterable<Entity> tags = attributeEntity.getEntities(AttributeMetadata.TAGS);
Iterable<Entity> newTags =
StreamSupport.stream(tags.spliterator(), false)
.filter(e -> !isSameTag(relationIRI, ontologyTermIRI, e))
.collect(Collectors.toList());
attributeEntity.set(AttributeMetadata.TAGS, newTags);
dataService.update(ATTRIBUTE_META_DATA, attributeEntity);
updateEntityTypeEntityWithNewAttributeEntity(entity, attribute, attributeEntity);
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
@Override
public void addAttributeTag(
EntityType entityType, SemanticTag<Attribute, LabeledResource, LabeledResource> tag) {
Entity entity = findAttributeEntity(entityType, tag.getSubject().getName());
List<Entity> tags = new ArrayList<>();
for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS)) {
tags.add(tagEntity);
}
tags.add(getTagEntity(tag));
entity.set(AttributeMetadata.TAGS, tags);
dataService.update(ATTRIBUTE_META_DATA, entity);
}
代码示例来源:origin: org.molgenis/molgenis-data-semanticsearch
@Override
public void addAttributeTag(EntityType entityType, SemanticTag<Attribute, LabeledResource, LabeledResource> tag)
{
Entity entity = findAttributeEntity(entityType, tag.getSubject().getName());
List<Entity> tags = new ArrayList<Entity>();
for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS))
{
tags.add(tagEntity);
}
tags.add(getTagEntity(tag));
entity.set(AttributeMetadata.TAGS, tags);
dataService.update(ATTRIBUTE_META_DATA, entity);
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
@Override
public Iterable<SemanticTag<Package, OntologyTerm, Ontology>> getTagsForPackage(
Package aPackage) {
Entity packageEntity = dataService.findOneById(PACKAGE, aPackage.getId());
if (packageEntity == null) {
throw new UnknownEntityException(PACKAGE, aPackage.getId());
}
List<SemanticTag<Package, OntologyTerm, Ontology>> tags = Lists.newArrayList();
for (Entity tagEntity : packageEntity.getEntities(PackageMetadata.TAGS)) {
tags.add(asTag(aPackage, tagEntity));
}
return tags;
}
代码示例来源:origin: org.molgenis/molgenis-ontology-core
private String getOntologyTermNodePath(OntologyTerm ontologyTerm) {
Entity ontologyTermEntity =
dataService.findOne(
ONTOLOGY_TERM, new QueryImpl<>().eq(ONTOLOGY_TERM_IRI, ontologyTerm.getIRI()));
Iterable<Entity> ontologyTermNodePathEntities =
ontologyTermEntity.getEntities(OntologyTermMetaData.ONTOLOGY_TERM_NODE_PATH);
return ontologyTermNodePathEntities
.iterator()
.next()
.getString(OntologyTermNodePathMetaData.NODE_PATH);
}
代码示例来源:origin: org.molgenis/molgenis-data-semanticsearch
@Override
@RunAsSystem
public Multimap<Relation, LabeledResource> getTagsForAttribute(EntityType entityType, Attribute attribute)
{
Entity entity = findAttributeEntity(entityType, attribute.getName());
if (entity == null) return ArrayListMultimap.<Relation, LabeledResource>create();
Multimap<Relation, LabeledResource> tags = ArrayListMultimap.<Relation, LabeledResource>create();
for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS))
{
SemanticTag<Attribute, LabeledResource, LabeledResource> tag = SemanticTag.asTag(attribute, tagEntity);
tags.put(tag.getRelation(), tag.getObject());
}
return tags;
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
@Override
@RunAsSystem
public Multimap<Relation, LabeledResource> getTagsForAttribute(
EntityType entityType, Attribute attribute) {
Entity entity = findAttributeEntity(entityType, attribute.getName());
if (entity == null) return ArrayListMultimap.create();
Multimap<Relation, LabeledResource> tags = ArrayListMultimap.create();
for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS)) {
SemanticTag<Attribute, LabeledResource, LabeledResource> tag =
SemanticTag.asTag(attribute, tagEntity);
tags.put(tag.getRelation(), tag.getObject());
}
return tags;
}
代码示例来源:origin: org.molgenis/molgenis-data-semanticsearch
@Override
public void addAttributeTag(EntityType entityType, SemanticTag<Attribute, OntologyTerm, Ontology> tag)
{
Entity entity = findAttributeEntity(entityType.getId(), tag.getSubject().getName());
List<Entity> tags = new ArrayList<Entity>();
for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS))
{
tags.add(tagEntity);
}
tags.add(getTagEntity(tag));
entity.set(AttributeMetadata.TAGS, tags);
dataService.update(ATTRIBUTE_META_DATA, entity);
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
@Override
public void addAttributeTag(
EntityType entityType, SemanticTag<Attribute, OntologyTerm, Ontology> tag) {
Entity entity = findAttributeEntity(entityType.getId(), tag.getSubject().getName());
List<Entity> tags = new ArrayList<>();
for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS)) {
tags.add(tagEntity);
}
tags.add(getTagEntity(tag));
entity.set(AttributeMetadata.TAGS, tags);
dataService.update(ATTRIBUTE_META_DATA, entity);
}
代码示例来源:origin: org.molgenis/molgenis-data-semanticsearch
@Override
public void removeAttributeTag(String entity, String attribute, String relationIRI, String ontologyTermIRI)
{
Entity attributeEntity = findAttributeEntity(entity, attribute);
Iterable<Entity> tags = attributeEntity.getEntities(AttributeMetadata.TAGS);
Iterable<Entity> newTags = Iterables.filter(tags, e -> !isSameTag(relationIRI, ontologyTermIRI, e));
attributeEntity.set(AttributeMetadata.TAGS, newTags);
dataService.update(ATTRIBUTE_META_DATA, attributeEntity);
updateEntityTypeEntityWithNewAttributeEntity(entity, attribute, attributeEntity);
}
代码示例来源:origin: org.molgenis/molgenis-data-semanticsearch
@Override
public void removeAttributeTag(EntityType entityType, SemanticTag<Attribute, OntologyTerm, Ontology> removeTag)
{
Attribute attribute = removeTag.getSubject();
Entity attributeEntity = findAttributeEntity(entityType.getId(), attribute.getName());
List<Entity> tags = new ArrayList<Entity>();
for (Entity tagEntity : attributeEntity.getEntities(AttributeMetadata.TAGS))
{
SemanticTag<Attribute, OntologyTerm, Ontology> tag = asTag(attribute, tagEntity);
if (!removeTag.equals(tag))
{
tags.add(tagEntity);
}
}
attributeEntity.set(AttributeMetadata.TAGS, tags);
dataService.update(ATTRIBUTE_META_DATA, attributeEntity);
}
代码示例来源:origin: org.molgenis/molgenis-semantic-search
/** A helper function that gets identifiers of all the attributes from one EntityType */
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;
}
内容来源于网络,如有侵权,请联系作者删除!