alcaeus
Version:
Hydra Core hypermedia-aware client library
23 lines (22 loc) • 831 B
JavaScript
import { hydra, rdf } from '@tpluscode/rdf-ns-builders';
const propertyRangeMappings = [
[],
[],
[],
[],
[],
[],
[],
[],
[],
];
export function* inferTypesFromPropertyRanges(dataset, env) {
const node = env.clownface({ dataset });
for (const mapping of propertyRangeMappings) {
const [property, type] = mapping;
const subjects = node.out(property);
for (const subject of subjects.terms) {
yield env.quad(subject, rdf.type, type);
}
}
}