ePages 6.9 - DE_EPAGES/Object/API/Object/SemanticStructure.pm

Package DE_EPAGES::Object::API::Object::SemanticStructure

logical structure presenting an xml file that contains database content. the structure contains a lot of elements that are referenced by object path. every xml element has a lot of semantic structure attributes e.g. xml-file:

  • /Classes/object/sub1/sub2
  • /Classes/object/sub1/sub2/AttributeValue{Language->de;Name->Name}
  • /Classes/Product
  • /Classes/Product/Form{Name->Save}
  • /Classes/Product/Form{Name->Save}/FormField{Name->EnableAllShippingMethods} if changes where made please actualize: http://ep-support.intern.epages.de:8080/wiki/index.php/Image:SemanticStructure.jpeg http://ep-support.intern.epages.de:8080/wiki/index.php/Semantic_Structure

    @EXPORT_OK
    isEmpty
    getElements
    existsElement
    deleteElement
    existsSubElement
    getClass
    setSemStructAttribute
    getSemStructAttribute
    getSemStructAttributes
    existsSemStructAttribute
    setTagAttribute
    getTagAttribute
    getTagAttributes
    existsTagAttribute
    countTagAttributes
    deleteTagAttribute
    existsAdditionalTagAttributes
    getID
    existsID
    getIDValue
    existsIDPart
    getXMLTypeAddictedID
    getXMLType

    Functions

    addElement
    countTagAttributes
    deleteElement
    deleteTagAttribute
    existsAdditionalTagAttributes
    existsElement
    existsIDPart
    existsSemStructAttribute
    existsSubElement
    existsTagAttribute
    getChildElements
    getClass
    getElements
    getID
    getIDValue
    getSemStructAttribute
    getSemStructAttributes
    getTagAttribute
    getTagAttributes
    getXMLType
    getXMLTypeAddictedID
    isEmpty
    new
    setID
    setSemStructAttribute
    setSemStructAttributes
    setTagAttribute
    setTagAttributes

    addElement

    adds a new element to the semantic structure.

    Syntax
    $self->addElement($ElementName,$Class,$hID, $hSemanticStructAttributes,$hTagAttributes);
    Example
    $self->addElement('/Class/Class1/Objects/Object1/Attributes/TranslationAttribute{Language->de;Name->Test}',
        'TranslationAttribute',
        {'Language' => 'de', 'Name' => 'Test'},
        {'TagName' => 'Attribute'},
        {'Meta' => 'Übersetzung', 'delete' => '1' }
    );
    Input
    $ElementName (string)
    name of element in semantic structure
    $Class (string)
    class of given element
    $hID (ref.hash.string)
    key value pairs of semantic structure identifier
    $hSemanticStructAttributes (ref.hash.string)
    key value pairs of semantic structure attributes
    $hID (ref.hash.string)
    key value pairs of tag attributes

    countTagAttributes

    return the number of tag attribute, from element

    Syntax
    my $CountTagAttr = $self->countTagAttributes($ElementName);
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $CountTagAttributes (int)
    value of tag attribute in elment

    deleteElement

    removes an element with given path from semantic structure.

    Syntax
    $self->deleteElement($ElementName);
    Input
    $ElementName (string)
    name of element in semantic structure

    deleteTagAttribute

    delete the attribute of element in semantic structure

    Syntax
    $self->deleteTagAttribute($ElementName, $TagAttributeName);
    Input
    $ElementName (string)
    name of element in semantic structure
    $TagAttributeName (string)
    name of tag attribute in semantic structure

    existsAdditionalTagAttributes

    return true if additionally attributes exists besides the attributes in array. return false if only the given attributes exists.

    Syntax
    my $Exists = $self->existsAdditionalTagAttributes($ElementName,$aControlAttributeNames);
    Input
    $ElementName (string)
    name of element in semantic structure
    $aControlAttributeNames (ref.array)
    ref of array with attribute names that have to check
    Return
    $Exists (bool)
    false if only given attributes exists

    existsElement

    return true if the path of an element exists in the semantic structure.

    Syntax
    my $ExistsElement = $self->existsElement($ElementName);
    Input
    $ExistsElement (bool)
    true if name (path) of element exists

    existsIDPart

    return true if part of id for element exists

    Syntax
    my $Exists = $self->existsIDPart($ElementName,$IDName);
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $Exists (bool)
    true if exists identifier name for given element

    existsSemStructAttribute

    return true if semantic structure element exists for given element

    Syntax
    my $Exists = $self->existsSemStructAttribute($ElementName, $SemStructAttributeName);
    Input
    $ElementName (string)
    name of element in semantic structure
    $SemStructAttributeName (string)
    name of semantic structure attribute
    Return
    $Exists (bool)
    true if semantic structure attribute exists

    existsSubElement

    return true if one ore more sub elements of given element exists

    Syntax
    my $Exists = $self->existsSubElement($ElementName);
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $Exists (bool)
    true if a sub element exists

    existsTagAttribute

    return true if if the attribute of element exists

    Syntax
    my $ExistsTagAttribute = $self->existsTagAttribute($ElementName, $TagAttributeName);
    Input
    $ElementName (string)
    name of element in semantic structure
    $TagAttributeName (string)
    name of tag attribute in semantic structure

    getChildElements

    return a list with the names of all child elements in the semantic structure of a given elementname.

    Syntax
    my @ChildElements = @{$self->getChildElements()};
    Return
    $aChildElements (ref.array)
    reference to array that contains the names of all child elements
    of a given element name in the semantic structure

    getClass

    return class element exists

    Syntax
    my $Value = $self->getClass($ElementName);
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $Class (string)
    class of given element

    getElements

    return a list with the names of all elements in the semantic structure. the names are always the pathes of the elements.

    Syntax
    my @Elements = @{$self->getElements()};
    Return
    $aElements (ref.array)
    reference to array that contains the names of all elements
    in the semantic structure

    getID

    return the identifier of given element

    Syntax
    my $hID = $self->getID($ElementName);
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $hID (ref.hash.string)
    hash contains key value pairs of ID

    getIDValue

    return part of id for element exists

    Syntax
    my $Value = $self->getIDValue($ElementName,$IDName);
    Input
    $ElementName (string)
    name of element in semantic structure
    $IDName (string)
    name of id part
    Return
    $Value (string)
    value of id part for given element

    getSemStructAttribute

    get the semantic structure attribute of element like _SemStruct-Class=?

    Syntax
    my $SemStructAttr = $self->getSemStructAttribute($ElementName, $SemStructAttributeName);
    Input
    $ElementName (string)
    name of element in semantic structure
    $SemStructAttributeName (string)
    name of attribute in semantic structure
    Return
    $SemStructAttributeValue (ref.hash/string/int)
    value of tag attribute in elment

    getSemStructAttributes

    get list of semantic structure attributes for element

    Syntax
    my @SemStructAttributes = @{$self->getSemStructAttributes($ElementName)};
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $aSemStructAttributes (ref.array)
    list of names from semantic structure attributes

    getTagAttribute

    return the value of tag attribute of the element

    Syntax
    my $Value = $self->getTagAttribute($ElementName, $TagAttributeName);
    Input
    $ElementName (string)
    name of element in semantic structure
    $TagAttributeName (string)
    name of tag attribute in semantic structure
    Return
    $TagAttribute (string)
    value of tag attribute in elment

    getTagAttributes

    return a sorted array with names of tag attributes for given array.

    Syntax
    my @Attributes = @{$self->getTagAttributes($ElementName)};
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $aTagAttributes (ref.array)
    names of tag attributes of given element

    getXMLType

    returns the type of xml [epages_standard|epages_translation]

    Syntax
    my $XMLType = $self->getXMLType();
    Return
    $XMLType (string)
    name of xml type

    getXMLTypeAddictedID

    return the identifier of given element addicted by the xml type the only known difference is AttributeValue tags in translation file, they are addressed only by Name because translation xml files have a global language tag.

    Syntax
    my $hID = $self->getXMLTypeAddictedID($ElementName);
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $hID (ref.hash.string)
    hash contains key value pairs of ID

    isEmpty

    return true if no elements are in semantic structure ore only elements that have no effect for sub pathes like global tags like <epages>, ...

    Syntax
    my $IsEmpty = $self->isEmpty();
    Return
    $IsEmpty (bool)
    true if there are only elements are in structure that have no meaning

    new

    constructor for semantic structure object.

    Syntax
    $self->new($hSemStructHash, $XMLType);
    Input
    $hSemStructHash (ref.hash)
    hash contains the data of a semantic structure
    $XMLType (str)
    type of xml file, normally 'standard' or 'translation'

    setID

    set the identifier of given element

    Syntax
    $self->setID($ElementName, {'ID1' => 'Value1', 'ID2' => 'Value2'});
    Input
    $ElementName (string)
    name of element in semantic structure
    Return
    $hID (ref.hash.string)
    hash contains key value pairs of ID

    setSemStructAttribute

    set the semantic structure attribute of element like _SemStruct-Class='Object'

    Syntax
    $self->setSemStructAttribute($ElementName, $SemStructAttributeName, $SemStructAttributeValue);
    Input
    $ElementName (string)
    name of element in semantic structure
    $SemStructAttributeName (string)
    name of attribute in semantic structure
    $SemStructAttributeValue (string)
    value of tag attribute in elment

    setSemStructAttributes

    set the semantic structure attributes for an element

    Syntax
    $self->setSemStructAttributes($ElementName, $hSemStructAttributes);
    Input
    $ElementName (string)
    name of element in semantic structure
    $hSemStructAttributes (ref.hash.string)
    key value pairs of semantic structure attributes

    setTagAttribute

    set the attribute value of element in semantic structure

    Syntax
    $self->setTagAttribute($ElementName, $TagAttributeName, $Value);
    Input
    $ElementName (string)
    name of element in semantic structure
    $TagAttributeName (string)
    name of tag attribute in semantic structure
    $Value (string)
    value to set

    setTagAttributes

    set the tag attributes for a semantic structure element. if a tag attribute already exists it will be overwrite.

    Syntax
    $self->setTagAttributes($ElementName, $hTagAttributes);
    Input
    $ElementName (string)
    name of element in semantic structure
    $hTagAttributes (ref.hash)
    key value pairs of tag attributes