Semantics

annotation class Semantics(val value: Array<With> = [])

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.

Properties

Link copied to clipboard

The semantic properties for this field.