vertex

module:formatters. vertex

Source:

Utilities that assist in transforming vertices and edges.

Namespaces

metadata
properties

Methods

(static) concept(vertex) → {object}

Source:

Given a vertex, get the ontology concept object.

If not found in ontology returns the root concept

Parameters:
Name Type Description
vertex object
Returns:

concept

Type
object

(static) conceptProperties(vertex) → {Array.<object>}

Source:

Given a vertex get all valid properties for that vertex concept and all parent concepts

Parameters:
Name Type Description
vertex object
Returns:

Valid properties for concept

Type
Array.<object>

(static) getVertexIdsFromDataEventOrCurrentSelection(data, optsopt) → {Array.<string>}

Source:

Helper to get vertexIds from either an events data or the current selection.

Useful to get the vertexIds that should be transformed based on context menus.

Parameters:
Name Type Attributes Default Description
data object

Some event data

opts object <optional>
{}

Options

Properties
Name Type Attributes Default Description
async object <optional>
false

Returns a promise if true

Returns:

the vertex ids

Type
Array.<string>

(static) hasMetadata(property, metadataPropertyNames) → {boolean}

Source:

Check if the property has any of the given metadata values

Parameters:
Name Type Description
property object

The property to check

metadataPropertyNames Array.<string>

The metadata names to check if there are values

Returns:

True if any of the metadata exists

Type
boolean

(static) hasProperty(vertex, propertyName) → {boolean}

Source:

Check if the vertex concept has the property.

Does not check if the vertex has the property, just that the concept (or ancestors) lists it as valid in ontology.

Parameters:
Name Type Description
vertex object
propertyName string
Returns:

if the vertex has the property

Type
boolean

(static) image(vertex, optionalWorkspaceId=opt, widthopt) → {string}

Source:

Get the image representing this vertex

Parameters:
Name Type Attributes Default Description
vertex object
optionalWorkspaceId= object <optional>
width number <optional>
400
Returns:

url to image

Type
string

(static) imageDetail(vertex, optionalWorkspaceId=opt) → {string}

Source:

Larger version of vertex image. 800 pixels.

Used in the Inspector.

Parameters:
Name Type Attributes Description
vertex object
optionalWorkspaceId= object <optional>
Returns:

url to image

Type
string

(static) imageIsFromConcept(vertex, optionalWorkspaceId=opt) → {boolean}

Source:

Check if this element has a custom image, or if it will just display the concepts icon.

Parameters:
Name Type Attributes Description
vertex object
optionalWorkspaceId= object <optional>
Returns:

true if the image for vertex is just the concept icon.

Type
boolean

(static) isEdge(element) → {boolean}

Source:

Check if the element is edge

Parameters:
Name Type Description
element object
Returns:

If element is a edge

Type
boolean

(static) isKindOfConcept(vertex, conceptTypeFilter) → {boolean}

Source:

Check if the vertex concept (or concept ancestors) matches the filter.

Parameters:
Name Type Description
vertex object
conceptTypeFilter string

IRI of concept

Returns:

if the vertex concept matches the filter

Type
boolean

(static) isPublished(element) → {boolean}

Source:

Check if the passed object is currently published from a case

Parameters:
Name Type Description
element Object

The vertex/edge json to check

Returns:

Whether the element is published

Type
boolean

(static) isVertex(element) → {boolean}

Source:

Check if the element is vertex

Parameters:
Name Type Description
element object
Returns:

If element is a vertex

Type
boolean

(static) longestProp(vertex, optionalName=opt) → {object}

Source:

Get the longest property value, optionally for given propertyName only.

Parameters:
Name Type Attributes Description
vertex object
optionalName= string <optional>

Property name

Returns:

The property

Type
object

(static) ontology(element) → {object}

Source:

Given a vertex or edge, get the ontology concept/relationship object.

If not found in ontology returns root concept (if vertex) or null (if relationship).

Parameters:
Name Type Description
element object
Returns:

ontology

Type
object

(static) prop(vertex, name, key=opt, optionalOpts=opt)

Source:

Get the first property value transformed for display using propDisplay

Parameters:
Name Type Attributes Description
vertex object
name string

Property IRI

key= string <optional>

Property key, if not given the first is returned

optionalOpts= object <optional>

Options

optionalOpts.ignoreDisplayFormula object <optional>

Ignore any formula defined in ontology

(static) propDisplay(name, value, options=opt) → {string}

Source:

Given a property name and value, convert to a displayable value for a user.

For the raw property value use propRaw.

Example
F.vertex.propDisplay(name, value, {
    prettyPrint: true,
    plural: ['person', 'people']
})
Parameters:
Name Type Attributes Description
name string

The property name IRI

value object

The value

options= object <optional>

Additional string transforms. Any function defined in module:util/vertex/formatters.string as the key and boolean if active or an array of arguments to pass to the transform function

Returns:

display value

Type
string

(static) propRaw(vertex, name, key=opt, options=opt) → {object}

Source:

Get the first property value as raw value. For a transformed value use prop

Parameters:
Name Type Attributes Description
vertex object
name string

Property IRI

key= string <optional>

Property key, if not given the first is returned

options= object <optional>

Options

options.defaultValue object

If no value

Returns:

The raw property value

Type
object

(static) props(element, name, key=opt) → {Array.<object>}

Source:

Return list of all matching properties.

Parameters:
Name Type Attributes Description
element object
name string

Property IRI

key= string <optional>

Property key

Returns:

All properties matching

Type
Array.<object>

(static) relationship(edge) → {object}

Source:

Given an edge, get the ontology relationship object.

If not found in ontology returns undefined

Parameters:
Name Type Description
edge object
Returns:

relationship

Type
object

(static) sandboxStatus(Vertex) → {string|undefined}

Source:

Get the state of the vertex or property

  • published: Unpublished in case or Published but changed in case
  • undefined: Published and not changed in case
Parameters:
Name Type Description
Vertex object

or property json

Returns:

result

Type
string | undefined

(static) selectedImage(vertex, optionalWorkspaceId=opt, widthopt) → {string}

Source:

Get the vertex image when selected (if available). Otherwise just return main image.

Parameters:
Name Type Attributes Default Description
vertex object
optionalWorkspaceId= object <optional>
width number <optional>
400
Returns:

url to image

Type
string

(static) subtitle(vertex) → {string}

Source:

Get the subtitle of the element, using subtitle formula

Parameters:
Name Type Description
vertex object
Returns:

The display subtitle for vertex

Type
string

(static) time(vertex) → {string}

Source:

Get the time of the element, using subtitle formula.

Nothing enforces that this is time value. Just returns a string.

Parameters:
Name Type Description
vertex object
Returns:

The display time for vertex

Type
string

(static) title(vertex) → {string}

Source:

Get the title of the element, using order:

  1. Use the title formula in the ontology
  2. Use the title property
Parameters:
Name Type Description
vertex object
Returns:

The display title for vertex

Type
string