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
)Content copied to clipboard
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;
}Content copied to clipboard
Java example (interface with getter):
public interface HasEmployment {
@Semantics({
@With(key = "predicate", value = "works at"),
@With(key = "inverse", value = "employs")
})
Company getWorksAt();
}Content copied to clipboard
The metadata is accessible via PropertyDefinition.metadata as a Map