Terms
Declaring vocabulary with $isATermFor
What Are Terms?
Terms are the vocabulary of your LinkedRecords application. Before you can use a term as an object in any fact, you must declare the term first.
Think of terms as defining the "types" or "categories" in your data model.
Declaring Terms
Use the $isATermFor predicate to declare a new term:
Critical: You MUST declare a term before using it as an object in any fact. If you skip this step, the fact creation will fail silently.
Using Declared Terms
Once declared, you can use terms to classify your attributes:
Terms Are Public
Unlike most data in LinkedRecords, terms are visible to all users. This allows:
- Different users to classify their own data using the same vocabulary
- Shared understanding of data types across an organization
- Queries that work across user boundaries (when combined with proper access grants)
Term Uniqueness
Each term can only be declared once. Attempting to declare the same term multiple times has no effect - only the first declaration counts:
Declaring Multiple Terms
It's efficient to declare all your application's terms at startup:
Calling this function multiple times is safe - duplicate declarations are ignored. This makes it suitable for app initialization code that may run on each page load.
Querying by Terms
Find all attributes of a specific type:
Find attributes of multiple types:
Deleting Terms
Only the user who created a term can delete it:
Common Gotchas
1. Forgetting to Declare Terms
2. Term Description is Required but Not Validated
The third part of a term declaration (the description) is required but not actively validated. However, you should still provide meaningful descriptions: future versions of LinkedRecords will use these descriptions to automatically generate Model Context Protocol (MCP) APIs. This means AI agents will be able to work with your LinkedRecords application out of the box - you get MCP support for free just by describing your terms.
3. Terms Don't Grant Access
Declaring a term doesn't give you access to other users' data. Terms just establish shared vocabulary:
Best Practices
-
Declare all terms at app startup - This ensures terms are available before any user actions
-
Use descriptive names - Terms should clearly indicate what they represent
-
Document your terms - Even though descriptions aren't displayed anywhere, they serve as documentation for your data model
-
Keep terms consistent - Use the same terms across your entire application for a coherent data model