KnowledgeSearchPolicy constructor
KnowledgeSearchPolicy({})
Implementation
KnowledgeSearchPolicy({
this.currentOnly = false,
this.asOf,
Set<OkfLifecycleStatus>? statuses,
Set<String> conceptTypes = const {},
Set<String> pathPrefixes = const {},
this.expandRelationships = false,
Map<String, String> governingSources = const {},
}) : statuses = statuses == null ? null : Set.unmodifiable(statuses),
conceptTypes = Set.unmodifiable(conceptTypes),
pathPrefixes = Set.unmodifiable(pathPrefixes),
governingSources = Map.unmodifiable(governingSources) {
if (currentOnly && asOf == null) {
throw ArgumentError('currentOnly requires an explicit asOf date.');
}
for (final start in governingSources.keys) {
final visited = <String>{};
String? path = start;
while (path != null) {
if (!visited.add(path)) {
throw ArgumentError('Cyclic governing sources: $start');
}
path = governingSources[path];
}
}
}