predicates property
Get all unique predicates (properties) in this graph
Returns a set containing all predicate resources that appear as the predicate component of any triple in this graph. The result is computed efficiently using the internal index if available and indexing is enabled.
Performance: If indexing is enabled, the first call to this method may trigger lazy creation of the internal index. Subsequent calls will use the cached index for improved performance.
Returns: An unmodifiable set of all predicates in the graph. The set may be empty if the graph contains no triples.
Example:
// Find all properties used in the graph
final allProperties = graph.predicates;
print('Graph uses ${allProperties.length} different properties');
Implementation
Set<RdfPredicate> get predicates => switch (_effectiveIndex) {
null => _triples.map((triple) => triple.predicate).toSet(),
final index =>
index.values.expand((predicateMap) => predicateMap.keys).toSet(),
};