Create a new ROCrate object using a default template or from a valid jsonld object.
a valid jsonld object
Optional
config: { Always return property of an Entity as an array (eg when using getEntity() method)
The default value for @type
to be used when adding a new entity and the property is not specified. Default to 'Thing'
Allow duplicate values in a property that has multiple values
Resolve linked node as nested object
When replacing or updating an entity, merge the values and the properties instead of full replace
When importing from json, a subsequent duplicate entity always replaces the existing one
Internal representation of the context
Index of all context contents or terms
Lookup table to index nodes by their properties
Lookup table to get a reference to existing and non-existing nodes. This is needed to avoid searching for the whole graph for every "@reverse" lookup as an entity referenced by other entities may not exist yet in the graph.
Import Utils class directly
Static
defaultsThe context part of the crate. An alias for '@context'. This returns the original context information.
An array of all nodes in the graph. An alias for '@graph'
The root identifier of the RO Crate
Create a new node or return an existing node with the given data
Identifier of the node (@id)
Optional
ref: NodeRefAn immutable and unique reference to node that contains id and reverse information only
a newly created or existing node that matches the id
Init a new node or update existing one
Update the node with the given data
If true, create an entity even if the data is empty
If false and if node already exists, remove all existing properties not in the specified data
Process nested objects recursively
If false and if node already exists, do nothing to the node
A set to keep track of cyclic reference in the input
Return true if node is changed
Append the specified string or object directly as an entry into the RO-Crate JSON-LD Context array. It does not check for duplicates or overlapping content if the context is an object.
A URL or an Object that contains the context mapping
Add an entity to the crate.
A valid RO-Crate entity described in plain object.
If true, nested entities will be added as well.
If true, replace existing entity with the same id.
true if the entity is successfully added.
Add a new identifier as a PropertyValue to the root DataSet. identifier and name are required parameters
The added identifier or undefined
Add one or more value to a property of an entity. If the specified property does not exists, a new one will be set. If the property already exists, the new value will be added to the property array.
The id or the entity to add the property to
The name of the property
The value of the property
If true, allow a property to have duplicate values in the array
Use updateEntityId
Use union, eg: union([sg1, sg2])
Delete an entity from the graph
Entity Identifier or the entity object itself
Set true to delete all references to the deleted entity
True if any existing entity was deleted
The raw data of deleted entity
Use deleteEntity
Delete one or more values from a property.
Returns a new iterator object that contains the entities in the graph.
Filter the result based on the values of the properties defined in this object.
If true, return the copy of entity as a plain object.
Use getGraph with argument set to true
Use toJSON
Use getIdentifier
Use getTree with the following argument: { root, depth, allowCycle: true }
Use rootDataset
Use rootId
Return a JSON.stringify-ready tree structure starting from the specified item
with all values (apart from @id) as arrays
and string-values expressed like: {"@value": "string-value"}
The number of nesting the tree will have. Must be 0 or positive integer.
the root entity
Create a simple tree-like object - but don't make circular structures
Use getTree with the valueObject argument set to false`
Add a value to an item's property array
Use addValues
A JSON-LD item or array of [item]
An array of objects that represents a 'path' through the graph.
Object must have a "property" to follow, eg:
resolve(item, {"property": "miltaryService"});
and optionally a condition "includes", eg:
"includes": {"@type", "Action"}}
and optionally, a function "matchFn" which takes an item
as argument and returns a boolean, eg:
"matchFn": (item) => item['@id'].match(/anzsrc-for/)
Optional
subgraph: any[]If present and true, all intervening items during the traversal will be stored. If an array is passed, the intervening items will be stored in the array.
null, or an array of items
Use getGraph and pass true as the argument
Set a property of an entity with the given value. If a property with the same name exists, its existing value will be replaced with the specified value. If values contain nested non-empty entities, they will be processed recursively.
The id of the entity to add the property to
The name of the property
A value or an array of values
If true, allow a property to have duplicate values
Update an entity by replacing the object with the same id.
This operations will remove all properties of the existing entity and
add the new ones contained in data
, unless merge
argument is true.
If true, new properties will be merged. Defaults to config.merge
.
If true, nested entities will be updated as well.
false if there is no existing entity with the same id or data is empty.
Generated using TypeDoc
Class for building, navigating, testing and rendering ROCrates
Todo
import validation and rendering from Calcyte