Class SemiringCatalog
java.lang.Object
com.darkcollective.relix.provenance.SemiringCatalog
Which semirings are installed — the bundled six plus every one a discovered
SemiringLibrary offers, resolved by name.
Discovery happens once. Two independently-populated catalogs can disagree about what
a name means, and a name is what a --provenance request carries, so
installed() memoises a single scan and everything else reads it.
Clashes
Libraries are consulted in descendingpriority, and
the first to claim a name keeps it. A loss is reported through
System.Logger rather than being resolved silently — a semiring that turned out
not to be the one installed is otherwise indistinguishable from one that is.-
Method Summary
Modifier and TypeMethodDescriptionResolves a semiring by (case-insensitive) name or alias.static SemiringCatalogdiscover()RunsServiceLoaderdiscovery afresh, over the bundled library plus every installed one.static SemiringCatalogempty()Returns an empty catalog, holding no semirings at all.entries()Returns every installed semiring, in claiming order.Resolves a registry entry by (case-insensitive) name or alias — the semiring together with what it is called and what it means.static SemiringCatalogReturns the catalog of installed semirings.names()Returns the canonical names of every installed semiring, in claiming order.static SemiringCatalogof(List<SemiringLibrary> libraries) A catalog of exactly the given libraries — the bundled six are not added.static SemiringCatalogwithBuiltins(List<SemiringLibrary> extra) A catalog holding the bundled semirings and the given libraries, which are consulted ahead of the bundled ones at equal priority.
-
Method Details
-
installed
Returns the catalog of installed semirings. Discovery runs once, on first call.- Returns:
- the catalog of installed semirings
-
discover
RunsServiceLoaderdiscovery afresh, over the bundled library plus every installed one. Preferinstalled(); this exists for a host that changes its class loader between runs.A provider that fails to load is logged and skipped rather than failing the scan, so one broken library on the path does not take the built-in semirings with it.
- Returns:
- a freshly discovered catalog
-
of
A catalog of exactly the given libraries — the bundled six are not added. For a test or an embedder assembling its own set.- Parameters:
libraries- the libraries to read; must not be null- Returns:
- the catalog
-
withBuiltins
A catalog holding the bundled semirings and the given libraries, which are consulted ahead of the bundled ones at equal priority.- Parameters:
extra- the additional libraries; must not be null- Returns:
- the catalog
-
empty
Returns an empty catalog, holding no semirings at all.- Returns:
- an empty catalog, holding no semirings at all
-
byName
Resolves a semiring by (case-insensitive) name or alias.- Parameters:
name- the name; may benull- Returns:
- the matching semiring, or empty if
nameis null or unknown
-
entry
Resolves a registry entry by (case-insensitive) name or alias — the semiring together with what it is called and what it means.- Parameters:
name- the name; may benull- Returns:
- the matching entry, or empty if
nameis null or unknown
-
entries
Returns every installed semiring, in claiming order. Each appears once, under its canonical name; aliases resolve throughbyNamebut are not listed.- Returns:
- every installed semiring, in claiming order
-
names
Returns the canonical names of every installed semiring, in claiming order. This is the list to show in help and error messages.- Returns:
- the canonical names of every installed semiring, in claiming order
-