
Build cybed:relatedUnit metadata for an organizing unit
Source: R/jsonld-helpers.R
build_related_unit_metadata.RdSome frameworks relate one organizing unit to another: a job role to the
skills it requires, a knowledge unit to the outcomes it supports. The
plain cybed:relatedUnit edge records that the publisher relates the two
units and nothing more, so "which units does this unit point at" stays a
one-hop query. When the publisher qualifies the relation (a required
proficiency level, a named relation type), also emit a
build_unit_relation_node() for the pair.
Pass the result as (part of) the metadata argument of
build_organizing_unit_node() or build_role_node(). Call it ONCE per
source unit with every target that unit has: two calls merged with c()
give the node two cybed:relatedUnit keys, which is not valid JSON-LD.
Targets in several frameworks go in one call, with to_prefix given per
target.
Examples
build_related_unit_metadata(c("skill-a", "skill-b"), "otccf")
#> $`cybed:relatedUnit`
#> $`cybed:relatedUnit`[[1]]
#> $`cybed:relatedUnit`[[1]]$`@id`
#> [1] "otccf:skill-a"
#>
#>
#> $`cybed:relatedUnit`[[2]]
#> $`cybed:relatedUnit`[[2]]$`@id`
#> [1] "otccf:skill-b"
#>
#>
#>
# Targets in two frameworks, one call.
build_related_unit_metadata(c("skill-a", "OG-WRL-015"), c("otccf", "nice"))
#> $`cybed:relatedUnit`
#> $`cybed:relatedUnit`[[1]]
#> $`cybed:relatedUnit`[[1]]$`@id`
#> [1] "otccf:skill-a"
#>
#>
#> $`cybed:relatedUnit`[[2]]
#> $`cybed:relatedUnit`[[2]]$`@id`
#> [1] "nice:OG-WRL-015"
#>
#>
#>