mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-23 08:38:02 +00:00

* Add SearchScore annotation * Add back test-model * Remove search features * Fix to John's comments * simplify ranker * Fix checkstyle
56 lines
1.4 KiB
Java
56 lines
1.4 KiB
Java
package com.linkedin.metadata.models;
|
|
|
|
import com.linkedin.data.schema.RecordDataSchema;
|
|
import com.linkedin.data.schema.TyperefDataSchema;
|
|
import com.linkedin.metadata.models.annotation.EntityAnnotation;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
* A specification of a DataHub Entity
|
|
*/
|
|
public interface EntitySpec {
|
|
String getName();
|
|
|
|
EntityAnnotation getEntityAnnotation();
|
|
|
|
String getKeyAspectName();
|
|
|
|
AspectSpec getKeyAspectSpec();
|
|
|
|
List<AspectSpec> getAspectSpecs();
|
|
|
|
Map<String, AspectSpec> getAspectSpecMap();
|
|
|
|
Boolean hasAspect(String name);
|
|
|
|
AspectSpec getAspectSpec(String name);
|
|
|
|
RecordDataSchema getSnapshotSchema();
|
|
|
|
TyperefDataSchema getAspectTyperefSchema();
|
|
|
|
default List<SearchableFieldSpec> getSearchableFieldSpecs() {
|
|
return getAspectSpecs().stream()
|
|
.map(AspectSpec::getSearchableFieldSpecs)
|
|
.flatMap(List::stream)
|
|
.collect(Collectors.toList());
|
|
}
|
|
|
|
default List<SearchScoreFieldSpec> getSearchScoreFieldSpecs() {
|
|
return getAspectSpecs().stream()
|
|
.map(AspectSpec::getSearchScoreFieldSpecs)
|
|
.flatMap(List::stream)
|
|
.collect(Collectors.toList());
|
|
}
|
|
|
|
default List<RelationshipFieldSpec> getRelationshipFieldSpecs() {
|
|
return getAspectSpecs().stream()
|
|
.map(AspectSpec::getRelationshipFieldSpecs)
|
|
.flatMap(List::stream)
|
|
.collect(Collectors.toList());
|
|
}
|
|
}
|