基于规则引擎的数据核查方案




//扫频数据样本
//经度非空,为浮点数
rule "Test Longitude"

    when
        $dataSample:DataSample($dataSample.longitude != null && $dataSample.longitude matches "^(-?\d+)(\.\d+)?$")
    then
        save($dataSample);

end

//纬度非空,为浮点数
rule "Test Latitude"

    when
        $dataSample:DataSample($dataSample.latitude != null && $dataSample.latitude matches "^(-?\d+)(\.\d+)?$")
    then
        save($dataSample);

end

//EARFCN非空,为正整数
rule "Test EARFCN"

    when
        $dataSample:DataSample($dataSample.earfcn != null && $dataSample.earfcn matches "^[0-9]\d*$")
    then
        save($dataSample);

end

//PCI非空,为正整数
rule "Test PCI"

    when
        $dataSample:DataSample($dataSample.pci != null && $dataSample.pci matches "^[0-9]\d*$")
    then
        save($dataSample);

end

//R0_RP非空,为浮点数
rule "Test R0_RP"

    when
        $dataSample:DataSample($dataSample.r0_rp != null && $dataSample.r0_rp matches "^(-?\d+)(\.\d+)?$")
    then
        save($dataSample);

end

//LTE的工参数据
//CGI非空,开头为460-00-
rule "Test CGI"

    when
        $dataSample:DataSample($dataSample.cgi != null && $dataSample.cgi matches "^460-00-\d+-\d+$")
    then
        save($dataSample);

end

//Enodebid非空,为正整数
rule "Test Enodebid"

    when
        $dataSample:DataSample($dataSample.enodebid != null && $dataSample.enodebid matches "^[0-9]\d*$")
    then
        save($dataSample);

end

//CI非空,为正整数
rule "Test CI"

    when
        $dataSample:DataSample($dataSample.ci != null && $dataSample.ci matches "^[0-9]\d*$")
    then
        save($dataSample);

end

//小区中文名非空
rule "Test Cellname"

    when
        $dataSample:DataSample($dataSample.cellname != null && $dataSample.cellname != "")
    then
        save($dataSample);

end

//地市非空
rule "Test City"

    when
        $dataSample:DataSample($dataSample.city != null && $dataSample.city != "")
    then
        save($dataSample);

end

//经度非空,为浮点数
rule "Test Longitude"

    when
        $dataSample:DataSample($dataSample.longitude != null && $dataSample.longitude matches "^(-?\d+)(\.\d+)?$")
    then
        save($dataSample);

end

//纬度非空,为浮点数
rule "Test Latitude"

    when
        $dataSample:DataSample($dataSample.latitude != null && $dataSample.latitude matches "^(-?\d+)(\.\d+)?$")
    then
        save($dataSample);

end

//覆盖类型非空
rule "Test Covertype"

    when
        $dataSample:DataSample($dataSample.covertype != null && $dataSample.covertype != "")
    then
        save($dataSample);

end

//方位角非空,为浮点数
rule "Test Angle"

    when
        $dataSample:DataSample($dataSample.angle != null && $dataSample.angle matches "^(-?\d+)(\.\d+)?$")
    then
        save($dataSample);

end

//Enodeb名称非空
rule "Test Enodebname"

    when
        $dataSample:DataSample($dataSample.enodebname != null && $dataSample.enodebname != "")
    then
        save($dataSample);

end

//TAC非空,为正整数
rule "Test TAC"

    when
        $dataSample:DataSample($dataSample.tac != null && $dataSample.tac matches "^[0-9]\d*$")
    then
        save($dataSample);

end

//PCI非空,为正整数
rule "Test PCI"

    when
        $dataSample:DataSample($dataSample.pci != null && $dataSample.pci matches "^[0-9]\d*$")
    then
        save($dataSample);

end

你可能感兴趣的:(规则引擎)