NAME
DataModel - perfSONAR schemas expressed in perl, used to build binding perl objects collection
DESCRIPTION
perlish expression of the perfSONAR_PS RelaxNG Compact schemas
every element expressed as:
$subelement_defintion = {};...
$parameter = {'attrs' => {name => 'enum:param,default', value => 'scalar', xmlns => 'nmwg' },
elements => [[subelement1 => $subelement_defintion, 'unless:value'],
text => 'scalar',
};
Where 'attrs' referrs to the hash of attributes with xmlns for the namespace id ( from perfSONAR_PS::Datatypes::Namespace )
elements referrs to the array of elements, defined already and text stays for the text content of the element
there is some conditional logic allowed. In elements the third memebr is an optionla condition with syntax: '<if|unless>:<name1,name2,...>'
where <name1,name2...> might be list of any predefined attribute keys or element names.
In attributes hash and in text content definition this condition should be used
in place of 'scalar'. Another validation condition is supported: 'enum:<comma separated list of enunms>'. Its useful for enumerated
type of attributes ( not supported for elements). For multiple choice element definition use array ref:
[subelement1 => [$subelement_defintion1,$subelement_defintion2]]
SYNOPSIS
###
use DataModel qw($subject $endPointPair $parameter $parameters $commonTime $endPointPairL4);
## export all structures and adjust any:
##
## for exzample for pinger
push @{$subject->{elements}}, [endPointPair => [$endPointPair, $endPointPairL4]];
$subject->{attrs}->{xmlns} = 'pinger';
my $pingerDatum1 = {'attrs' => {value => 'scalar', valueUnits => 'scalar', seqNum => 'scalar',
numBytes => 'scalar', ttl => 'scalar', timeType => 'scalar', timeValue => 'scalar',
xmlns => 'pinger'},
elements => [],
};
my $pingerDatum2 = {'attrs' => {value => 'scalar', valueUnits => 'scalar',
name => 'enum:minRtt,maxRtt,meanRtt,medianRtt,lossPercent,clp,minIpd,maxIpd,iqrIpd,meanIpd',
timeType => 'scalar', timeValue => 'scalar', xmlns => 'pinger'},
elements => [],
};
%{$parameter} = ('attrs' => {name => 'enum:count,interval,packetSize,ttl,valueUnits', value => 'scalar', xmlns => 'nmwg'},
elements => [],
text => 'unless:value',
);
push @{$commonTime->{elements}}, [datum => [$pingerDatum1, $pingerDatum2 ]];
push @{$data->{elements}}, [datum => [$pingerDatum1, $pingerDatum2, $resultDatum]];
$parameters->{attrs}->{xmlns}= 'pinger';
####
### thats it, next step is to build API
Exportedvariables
$message $metadata $data $key $endPointPairL4 $datum $commonTime\ $endPointPairL3 $interfaceL3 $addressL4 $addressL3 $endPointPair $resultDatum $endPointL4 $subject $time $parameters $parameter