Elements represent the building blocks of everything in MN8. An element
is a primary data type which can have attributes and it's values can be
a Concept (basically everything).
$elem TYPEOF Element
$attr = Attribute.create("name", "jon")
$elem.addAttribute( $attr )
$elem.setValue("employee of the year")
PRINT $elem
name: jon
employee of the year
PRINT $elem.toXML< name="jon">employee of the yea</>
$elem.setLabel("employee")
PRINT $elem
employee
name: jon
employee of the year
PRINT $elem.toXML<employee name="jon">employee of the year</employee>
Methods inherited from: Concept
| cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
| Parameters: |
| $label : | The label of this Element. |
| $value : | The value of this Element. |
|
Constructs a new Element concept with the specified value and label.
Adds a new attribute to this Element.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
$attr typeof Attribute
$attr.setLabel("color")
$attr.setValue("blue")
print $test.getConceptElement("elem").getAttributes
$test.getConceptElement("elem").addAttribute($attr)
print $test.getConceptElement("elem").getAttributes
]
]
-- the result is --
color: blue
| Parameters: |
| $name : | The name of the attribute to add. |
| $label : | The label of the attribute to add. |
| $value : | The value of the attribute to add. |
|
Adds a new attribute to this element with the specified name, label and
value.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getAttributes
$test.getConceptElement("elem").addAttribute("attr", "color", "blue")
print $test.getConceptElement("elem").getAttributes
]
]
-- the result is --
color: blue
| Parameters: |
| $value : | The value to be added. |
|
Adds a new value to this Element.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getVAlue
$test.getConceptElement("elem").addValue("and this is the new value")
print $test.getConceptElement("elem").getVAlue
]
]
-- the result is --
This is the element initial value.
This is the element initial value.
and this is the new value.
Returns a series concept containing all attributes of this Element.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getAttributes
$test.getConceptElement("elem").addAttribute("attr", "color", "blue")
print $test.getConceptElement("elem").getAttributes
]
]
-- the result is --
color: blue
Returns a string concept representing this Element's label.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getLabel
]
]
-- the result is --
ElemLabel
Returns a string concept representing this Element's name.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getName
]
]
-- the result is --
elem
Returns a concept representing this Element's value.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getValue
]
]
-- the result is --
This is the element initial value.
Returns this concept's value type.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getValueType
]
]
-- the result is --
String
Returns true always when the element has as value more
items/elements (usualy a TypedSeries)
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").isMulti
]
]
-- the result is --
false
| Parameters: |
| $attributes : | Attributes to be set. |
|
Sets the attributes from the specified series to this Element concept.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getAttributes
$color typeof Attribute
$color.setLabel("color")
$color.setValue("blue")
$name typeof Attribute
$name.setLabel("name")
$name.setValue("John")
$attrs typeof Series
$attrs.add($color)
$attrs.add($name)
$test.getConceptElement("elem").setAttributes($attrs)
print $test.getConceptElement("elem").getAttributes
]
]
-- the result is --
color: blue
name: John
| Parameters: |
| $label : | The new label to be set. |
|
Sets the label of this Element concept to the specified text.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getLabel
$test.getConceptElement("elem").setLabel("NewLabel")
print $test.getConceptElement("elem").getLabel
]
]
-- the result is --
ElemLabel
NewLabel
| Parameters: |
| $value : | The value to be set. |
|
Sets the value of this Element concept to the specified value.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").getValue
$test.getConceptElement("elem").setValue("NewValue")
print $test.getConceptElement("elem").getValue
]
]
-- the result is --
This is the element initial value.
NewValue
Returns a stream representing the XML rendering of this concept.
define Test [
elem="This is the element initial value." label "ElemLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptElement("elem").toXML
]
]
-- the result is --
<ElemLabel>This is the element initial value.</ElemLabel>