Skip to content

Commit

Permalink
docs: Explain penalties map
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Jun 21, 2024
1 parent 80a1340 commit 0176aba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/rate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import {shacl, Valid} from './validator.js';
import {dcat, dct} from './query.js';
import {NamedNode} from '@rdfjs/types';

const penalties = new Map([
// If at least one of the properties in the map’s key is missing (e.g. either created or issued), apply the penalty
// specified in the map’s value (e.g. 10) is applied.
const penalties = new Map<NamedNode[], number>([
[[dct('description')], 20],
[[dcat('distribution')], 20],
[[dct('creator')], 10],
Expand Down Expand Up @@ -63,7 +66,7 @@ export class Rating {
public readonly explanation: string;

public constructor(
private readonly penalties: Penalty[],
readonly penalties: Penalty[],
public readonly worstRating: number,
public readonly bestRating = 100
) {
Expand Down

0 comments on commit 0176aba

Please sign in to comment.