Package com.embabel.agent.core
Annotation Semantics
-
- All Implemented Interfaces:
@Target(allowedTargets = {AnnotationTarget.FIELD, AnnotationTarget.PROPERTY}) public @interface Semantics
Defines semantic metadata for a property. This annotation allows attaching arbitrary key-value metadata to properties, which can be used for semantic processing such as proposition extraction, relationship mapping, and natural language generation.
Common semantic properties include:
predicate: The natural language predicate for the relationship (e.g., "works at")inverse: The inverse predicate for bidirectional reasoning (e.g., "employs")aliases: Alternative phrasings that map to this relationship
Kotlin example:
data class Person( val name: String, @Semantics([ With("predicate", "works at"), With("inverse", "employs"), With("aliases", "is employed by, works for") ]) val worksAt: Company )Java example (class with field):
public class Person { private String name; @Semantics({ @With(key = "predicate", value = "works at"), @With(key = "inverse", value = "employs"), @With(key = "aliases", value = "is employed by, works for") }) private Company worksAt; }Java example (interface with getter):
public interface HasEmployment { @Semantics({ @With(key = "predicate", value = "works at"), @With(key = "inverse", value = "employs") }) Company getWorksAt(); }The metadata is accessible via PropertyDefinition.metadata as a Map<String, String>.