Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# ODRL Evaluator release notes

## [0.5.1](https://github.com/SolidLabResearch/ODRL-Evaluator/compare/v0.5.0...v0.5.2) (2025-12-02)


### Features

* introduce generic request constraints + add utilities for generating policies and requests + add utility for parsing compliance reports ([7a4878f](https://github.com/SolidLabResearch/ODRL-Evaluator/commit/7a4878f3aee50f2d2ad1caf257273c515b05790a))


### Fixes

* add missing utility function for the test suite ([2f8576e](https://github.com/SolidLabResearch/ODRL-Evaluator/commit/2f8576ee9ed72512467f6adba41407ae1457d2f3))
* update js-yaml in package-lock for vulnerability reasons ([9d71463](https://github.com/SolidLabResearch/ODRL-Evaluator/commit/9d71463142b295cc0df412b1ef7d3fce83f107dd))

## [0.5.0](https://github.com/SolidLabResearch/ODRL-Evaluator/compare/v0.4.0...v0.5.0) (2025-10-15)

### Features
Expand Down
11 changes: 11 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# ODRL Evaluator

## 0.5.1

### New Features

* Support for all constraints (so for all Left Operands) following the approach of `sotw:Context`
* Addition of utilities for generating simple ODRL Policies and the ODRL Request as Quad[]
* `src/util/policy/PolicyUtil.ts`
* `src/util/request/RequestUtil.ts`
* Addition of a parser for the Compliance Report Util
* `src/util/report/ComplianceReportUtil.ts`

## v0.5.0

### New features
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "odrl-evaluator",
"version": "0.5.0",
"version": "0.5.1",
"description": "An open implementation of an ODRL Evaluator that evaluates ODRL policies by generating Compliance Reports",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/evaluator/Atomizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { replaceSubject } from "../util/RDFUtil";
/**
* Represents an ODRL policy containing its identifier and categorized rules.
*/
export type Policy = {
type Policy = {
/** Unique identifier for the policy */
identifier: Term,
/** List of permission rules associated with the policy */
Expand All @@ -28,7 +28,7 @@ export type Policy = {
/**
* Represents a single ODRL rule.
*/
export type Rule = {
type Rule = {
/** Identifier of the policy this rule belongs to */
policyID: Term,
/** Unique identifier for the rule */
Expand Down
3 changes: 3 additions & 0 deletions src/index.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ export * from './util/Vocabularies'
export * from './util/Prefixes'

export * from './util/report/ComplianceReportTypes'
export * from './util/report/ComplianceReportUtil'
export * from './util/policy/PolicyUtil'
export * from './util/request/RequestUtil'
export * from './util/report/ComplianceReportUtil'
36 changes: 21 additions & 15 deletions src/rules/Rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,53 +94,59 @@ export const RULES: string[] = [`@prefix string: <http://www.w3.org/2000/10/swap
?premiseReport report:constraintLeftOperand ?dateTime .
}.

# odrl:purpose
# https://www.w3.org/TR/odrl-vocab/#term-purpose
# Create empty premise report for purposes (no purpose present in the evaluation request)
# Other ODRL constraint Left operands
# Create empty premise report for leftOperands (no leftOperand present in the evaluation request)
{
# check for number of purposes in evaluation request
# acceptable ODRL Left Operands
?leftOperand list:in ( odrl:absolutePosition odrl:absoluteSize odrl:absoluteSpatialPosition odrl:absoluteTemporalPosition odrl:count odrl:delayPeriod odrl:deliveryChannel odrl:device odrl:elapsedTime odrl:event odrl:fileFormat odrl:industry odrl:language odrl:media odrl:meteredTime odrl:payAmount odrl:percentage odrl:product odrl:purpose odrl:recipient odrl:relativePosition odrl:relativeSize odrl:relativeSpatialPosition odrl:relativeTemporalPosition odrl:resolution odrl:spatial odrl:spatialCoordinates odrl:system odrl:systemDevice odrl:timeInterval odrl:unitOfCount odrl:version odrl:virtualLocation ) .

# check for number of leftOperands in evaluation request
(
?template
{
?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand odrl:purpose .
?requestContextConstraint odrl:leftOperand ?leftOperand .
}
?L
) log:collectAllIn ?SCOPE .
# number of purposes in evaluation request is 0
# number of leftOperands in evaluation request is 0
?L list:length 0 .

# a rule with a purpose constraint
# a rule with a leftOperand constraint
_:a odrl:constraint ?constraint .
?constraint odrl:leftOperand odrl:purpose .
?constraint odrl:leftOperand ?leftOperand .

# created premiseReport
?premiseReport report:constraint ?constraint .
} => {
?premiseReport report:constraintLeftOperand "" . #TODO: do we need a default purpose?
?premiseReport report:constraintLeftOperand "" . #TODO: do we need a default null left operand value?
}.

# Create empty premise report for purposes (one present in the evaluation request)
# Create empty premise report for leftOperands (one present in the evaluation request)
{
# acceptable ODRL Left Operands
?leftOperand list:in ( odrl:absolutePosition odrl:absoluteSize odrl:absoluteSpatialPosition odrl:absoluteTemporalPosition odrl:count odrl:delayPeriod odrl:deliveryChannel odrl:device odrl:elapsedTime odrl:event odrl:fileFormat odrl:industry odrl:language odrl:media odrl:meteredTime odrl:payAmount odrl:percentage odrl:product odrl:purpose odrl:recipient odrl:relativePosition odrl:relativeSize odrl:relativeSpatialPosition odrl:relativeTemporalPosition odrl:resolution odrl:spatial odrl:spatialCoordinates odrl:system odrl:systemDevice odrl:timeInterval odrl:unitOfCount odrl:version odrl:virtualLocation ) .


?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand odrl:purpose .
?requestContextConstraint odrl:leftOperand ?leftOperand .
?requestContextConstraint odrl:rightOperand ?requestedPurpose .

# check for number of purposes in evaluation request
# check for number of leftOperands in evaluation request
(
?template
{
?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand odrl:purpose .
?requestContextConstraint odrl:leftOperand ?leftOperand .
}
?L
) log:collectAllIn ?SCOPE .
# number of purposes in evaluation request is 1
# number of leftOperands in evaluation request is 1
?L list:length 1 .

# a rule with a purpose constraint
_:a odrl:constraint ?constraint .
?constraint odrl:leftOperand odrl:purpose .
?constraint odrl:leftOperand ?leftOperand .

# created premiseReport
?premiseReport report:constraint ?constraint .
Expand Down
36 changes: 21 additions & 15 deletions src/rules/constraints.n3
Original file line number Diff line number Diff line change
Expand Up @@ -57,53 +57,59 @@
?premiseReport report:constraintLeftOperand ?dateTime .
}.

# odrl:purpose
# https://www.w3.org/TR/odrl-vocab/#term-purpose
# Create empty premise report for purposes (no purpose present in the evaluation request)
# Other ODRL constraint Left operands
# Create empty premise report for leftOperands (no leftOperand present in the evaluation request)
{
# check for number of purposes in evaluation request
# acceptable ODRL Left Operands
?leftOperand list:in ( odrl:absolutePosition odrl:absoluteSize odrl:absoluteSpatialPosition odrl:absoluteTemporalPosition odrl:count odrl:delayPeriod odrl:deliveryChannel odrl:device odrl:elapsedTime odrl:event odrl:fileFormat odrl:industry odrl:language odrl:media odrl:meteredTime odrl:payAmount odrl:percentage odrl:product odrl:purpose odrl:recipient odrl:relativePosition odrl:relativeSize odrl:relativeSpatialPosition odrl:relativeTemporalPosition odrl:resolution odrl:spatial odrl:spatialCoordinates odrl:system odrl:systemDevice odrl:timeInterval odrl:unitOfCount odrl:version odrl:virtualLocation ) .

# check for number of leftOperands in evaluation request
(
?template
{
?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand odrl:purpose .
?requestContextConstraint odrl:leftOperand ?leftOperand .
}
?L
) log:collectAllIn ?SCOPE .
# number of purposes in evaluation request is 0
# number of leftOperands in evaluation request is 0
?L list:length 0 .

# a rule with a purpose constraint
# a rule with a leftOperand constraint
_:a odrl:constraint ?constraint .
?constraint odrl:leftOperand odrl:purpose .
?constraint odrl:leftOperand ?leftOperand .

# created premiseReport
?premiseReport report:constraint ?constraint .
} => {
?premiseReport report:constraintLeftOperand "" . #TODO: do we need a default purpose?
?premiseReport report:constraintLeftOperand "" . #TODO: do we need a default null left operand value?
}.

# Create empty premise report for purposes (one present in the evaluation request)
# Create empty premise report for leftOperands (one present in the evaluation request)
{
# acceptable ODRL Left Operands
?leftOperand list:in ( odrl:absolutePosition odrl:absoluteSize odrl:absoluteSpatialPosition odrl:absoluteTemporalPosition odrl:count odrl:delayPeriod odrl:deliveryChannel odrl:device odrl:elapsedTime odrl:event odrl:fileFormat odrl:industry odrl:language odrl:media odrl:meteredTime odrl:payAmount odrl:percentage odrl:product odrl:purpose odrl:recipient odrl:relativePosition odrl:relativeSize odrl:relativeSpatialPosition odrl:relativeTemporalPosition odrl:resolution odrl:spatial odrl:spatialCoordinates odrl:system odrl:systemDevice odrl:timeInterval odrl:unitOfCount odrl:version odrl:virtualLocation ) .


?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand odrl:purpose .
?requestContextConstraint odrl:leftOperand ?leftOperand .
?requestContextConstraint odrl:rightOperand ?requestedPurpose .

# check for number of purposes in evaluation request
# check for number of leftOperands in evaluation request
(
?template
{
?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand odrl:purpose .
?requestContextConstraint odrl:leftOperand ?leftOperand .
}
?L
) log:collectAllIn ?SCOPE .
# number of purposes in evaluation request is 1
# number of leftOperands in evaluation request is 1
?L list:length 1 .

# a rule with a purpose constraint
_:a odrl:constraint ?constraint .
?constraint odrl:leftOperand odrl:purpose .
?constraint odrl:leftOperand ?leftOperand .

# created premiseReport
?premiseReport report:constraint ?constraint .
Expand Down
3 changes: 2 additions & 1 deletion src/util/Prefixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export const prefixes = {
odrl: "http://www.w3.org/ns/odrl/2/",
schema: "https://schema.org/",
xsd: "http://www.w3.org/2001/XMLSchema#",
dpv: "https://w3id.org/dpv#"
dpv: "https://w3id.org/dpv#",
sotw: "https://w3id.org/force/sotw#"
}
9 changes: 9 additions & 0 deletions src/util/Util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { v4 as uuidv4 } from 'uuid';

/**
* Helper to generate URNs from UUIDs.
* Produces identifiers in the form: urn:uuid:<UUID>
*/
export function createRandomUrn(): string {
return `urn:uuid:${uuidv4()}`;
}
30 changes: 28 additions & 2 deletions src/util/Vocabularies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { createVocabulary } from 'rdf-vocabulary';

export const DC = createVocabulary(
'http://purl.org/dc/terms/',
'created'
'created',
'title',
'description'
)
export const RDF = createVocabulary(
'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
Expand Down Expand Up @@ -266,4 +268,28 @@ export const REPORT = createVocabulary('https://w3id.org/force/compliance-report
'deonticState',
'constraint',
'satisfactionState',
)
)

export const SOTW = createVocabulary('https://w3id.org/force/sotw#',
'context',
'SotW',
'currentTime',
'currentLocation',
'assetCollection',
'partyCollection',
'existingReport',
'count',
'event',
'accumulatedTime',
'recipient',
'paidAmount',
)


export const XSD = createVocabulary(
'http://www.w3.org/2001/XMLSchema#',
'dateTime',
'duration',
'integer',
'string',
);
Loading