FragmentParser - kridhaen/OpenTrafficLightsPrediction GitHub Wiki

The FragmentParser is used to parse the traffic light observations in Linked Data Fragments.

Use handleFragment method to parse a fragment. This method recieves 5 callback functions.

  • onPhaseChange: called if the signalphase has changed
  • onSamePhase: called if the signalphase did not change
  • (dangerous) onObservationBeforeValidityCheck: gets called before observations are checked for datagaps or incorrect data *afterHandle: gets called after the fragment is fully parsed *onFragmentError: called if an error in the data occured

For each callback, the following fields will be set correctly:

        "signalGroup": undefined,   //signalGroup of current observation
        "signalPhase": undefined,   //signalPhase of current observation
        "signalState": undefined,   //signalState quad (not used)
        "generatedAtTime": undefined,   //generation time of current observation
        "minEndTime": undefined,    //minEndTime defined in current observation
        "maxEndTime": undefined,    //maxEndTime defined in current observation
        "observation": undefined,   //observation quad (not used)
        "store": undefined, //n3 store object
        "prefixes": undefined,  //prefixes in trig rdf fragment
        "phaseStart": undefined,    //start of phase of current observation
        "lastPhaseStart": undefined,    //start of phase of last observation
        "lastPhase": undefined,  //phase of last observation
        "maxDidIncrease": undefined //maxEndTime did increase for same phase