ModifyActionExample.ttl
type: Ontology
default namespace: http://extensionsamples.topbraid.org/resourceactions/modifyactionexample#
imports: dash

Add German label...
type: ModifyAction
action group: Sample Modify Actions
action icon class: fas fa-language
js: focusNode.add(rdfs.label, graph.langString(germanLabel, 'de'))
js condition: // Returns true if the focusNode has no rdfs:label that has language 'de' !focusNode.values(rdfs.label).some((label) => label instanceof LiteralNode && label.lang == 'de')
comment: A sample ModifyAction that asks the user to enter a (German) label and then adds this to the currently selected focus node. The action is available from the Modify menu of any instance of owl:Thing (or a subclass of that), unless the instance already has a label with @de as language tag. You can try this out using the New Zealand instance of Country. Once you add a German language, the action will be disabled.
parameter: Parameter
  path: germanLabel
  datatype: string
  description: The label that shall be added to the selected asset. Should be in German :)
  name: German label

Country
type: Class
type: NodeShape
comment: Just a simple example class with a label property.
subclass of: Thing
property: Country-label

Country-label
type: PropertyShape
path: label
single line: true
name: labels
or: StringOrLangString

New Zealand
type: Country

Sample Modify Actions
type: ActionGroup