예제 #1
0
        private static List <Triple> ConvertWeatherStation(WeatherStationDto station, Dictionary <string, AirportDto> airports)
        {
            var triples = new TripleBuilder(nodeFactory.AsBlankNode(station.NodeId));

            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.Type), nodeFactory.AsValueNode(Constants.Types.WeatherStation));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.WeatherStationIata), nodeFactory.AsValueNode(station.IATA));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.WeatherStationName), nodeFactory.AsValueNode(station.Station));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.WeatherStationIcao), nodeFactory.AsValueNode(station.ICAO));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.WeatherStationLat), nodeFactory.AsValueNode(station.Latitude));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.WeatherStationLon), nodeFactory.AsValueNode(station.Longitude));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.WeatherStationSynop), nodeFactory.AsValueNode(station.SYNOP));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.WeatherStationElevation), nodeFactory.AsValueNode(station.Elevation));


            if (airports.TryGetValue(station.IATA, out AirportDto airport))
            {
                triples.AddWithSubject(
                    subj: nodeFactory.AsBlankNode(airport.NodeId),
                    pred: nodeFactory.AsUriNode(Constants.Predicates.HasWeatherStation),
                    obj: nodeFactory.AsBlankNode(station.NodeId));
            }

            return(triples.Build());
        }
예제 #2
0
        private static List <Triple> ConvertWeatherData(WeatherDataDto weather, Dictionary <string, WeatherStationDto> stations)
        {
            var triples = new TripleBuilder(nodeFactory.AsBlankNode(weather.NodeId));

            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.Type), nodeFactory.AsValueNode(Constants.Types.WeatherData));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataStation), nodeFactory.AsValueNode(weather.station));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataAlti), nodeFactory.AsValueNode(weather.alti));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataDrct), nodeFactory.AsValueNode(weather.drct));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataDwpc), nodeFactory.AsValueNode(weather.dwpc));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataDwpf), nodeFactory.AsValueNode(weather.dwpf));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataFeelc), nodeFactory.AsValueNode(weather.feelc));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataFeelf), nodeFactory.AsValueNode(weather.feelf));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataGust), nodeFactory.AsValueNode(weather.gust));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataIceAccretion1hr), nodeFactory.AsValueNode(weather.ice_accretion_1hr));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataIceAccretion3hr), nodeFactory.AsValueNode(weather.ice_accretion_3hr));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataIceAccretion6hr), nodeFactory.AsValueNode(weather.ice_accretion_6hr));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataLatitude), nodeFactory.AsValueNode(weather.lat));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataLongitude), nodeFactory.AsValueNode(weather.lon));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataMetar), nodeFactory.AsValueNode(weather.metar));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataMslp), nodeFactory.AsValueNode(weather.mslp));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataP01i), nodeFactory.AsValueNode(weather.p01i));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataPeakWindDrct), nodeFactory.AsValueNode(weather.peak_wind_drct));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataPeakWindGust), nodeFactory.AsValueNode(weather.peak_wind_gust));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataPeakWindTime_hh), nodeFactory.AsValueNode(weather.peak_wind_time_hh));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataPeakWindTime_MM), nodeFactory.AsValueNode(weather.peak_wind_time_MM));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataRelh), nodeFactory.AsValueNode(weather.relh));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSknt), nodeFactory.AsValueNode(weather.sknt));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyc1), nodeFactory.AsValueNode(weather.skyc1));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyc2), nodeFactory.AsValueNode(weather.skyc2));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyc3), nodeFactory.AsValueNode(weather.skyc3));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyc4), nodeFactory.AsValueNode(weather.skyc4));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyl1), nodeFactory.AsValueNode(weather.skyl1));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyl2), nodeFactory.AsValueNode(weather.skyl2));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyl3), nodeFactory.AsValueNode(weather.skyl3));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataSkyl4), nodeFactory.AsValueNode(weather.skyl4));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataTimestamp), nodeFactory.AsValueNode(weather.valid));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataTmpc), nodeFactory.AsValueNode(weather.tmpc));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataTmpf), nodeFactory.AsValueNode(weather.tmpf));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataVsbyKm), nodeFactory.AsValueNode(weather.vsby_km));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataVsbyMi), nodeFactory.AsValueNode(weather.vsby_mi));
            triples.Add(nodeFactory.CreateUriNode(Constants.Predicates.WeatherDataWxcodes), nodeFactory.AsValueNode(weather.wxcodes));

            if (stations.TryGetValue(weather.station, out WeatherStationDto station))
            {
                triples.Add(nodeFactory.AsUriNode(Constants.Predicates.HasStation), nodeFactory.AsBlankNode(station.NodeId));
            }

            return(triples.Build());
        }
예제 #3
0
        private static List <Triple> ConvertFlight(FlightDto flight, Dictionary <string, AircraftDto> aircrafts, Dictionary <string, AirportDto> airports, Dictionary <string, CarrierDto> carriers)
        {
            var triples = new TripleBuilder(nodeFactory.AsBlankNode(flight.NodeId));

            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.Type), nodeFactory.AsValueNode(Constants.Types.Flight));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightNumber), nodeFactory.AsValueNode(flight.FlightNumber));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightTailNumber), nodeFactory.AsValueNode(flight.TailNumber));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightDate), nodeFactory.AsValueNode(flight.FlightDate));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightDayOfWeek), nodeFactory.AsValueNode(flight.DayOfWeek));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightDayOfMonth), nodeFactory.AsValueNode(flight.DayOfMonth));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightMonth), nodeFactory.AsValueNode(flight.Month));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightYear), nodeFactory.AsValueNode(flight.Year));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightDistance), nodeFactory.AsValueNode(flight.Distance));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightArrivalDelay), nodeFactory.AsValueNode(flight.ArrivalDelay));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightCarrierDelay), nodeFactory.AsValueNode(flight.CarrierDelay));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightDepartureDelay), nodeFactory.AsValueNode(flight.DepartureDelay));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightLateAircraftDelay), nodeFactory.AsValueNode(flight.LateAircraftDelay));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightNasDelay), nodeFactory.AsValueNode(flight.NasDelay));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightSecurityDelay), nodeFactory.AsValueNode(flight.SecurityDelay));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightCancellationCode), nodeFactory.AsValueNode(flight.CancellationCode));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightWeatherDelay), nodeFactory.AsValueNode(flight.WeatherDelay));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightScheduledDepartureTime), nodeFactory.AsValueNode(flight.ScheduledDepartureTime));
            triples.Add(nodeFactory.AsUriNode(Constants.Predicates.FlightActualDepartureTime), nodeFactory.AsValueNode(flight.ActualDepartureTime));

            // Add Relations:
            if (aircrafts.TryGetValue(flight.TailNumber, out AircraftDto aircraft))
            {
                triples.Add(nodeFactory.AsUriNode(Constants.Predicates.HasAircraft), nodeFactory.AsBlankNode(aircraft.NodeId));
            }

            if (airports.TryGetValue(flight.OriginAirport, out AirportDto originAirport))
            {
                triples.Add(nodeFactory.AsUriNode(Constants.Predicates.HasOriginAirport), nodeFactory.AsBlankNode(originAirport.NodeId));
            }

            if (airports.TryGetValue(flight.DestinationAirport, out AirportDto destinationAirport))
            {
                triples.Add(nodeFactory.AsUriNode(Constants.Predicates.HasDestinationAirport), nodeFactory.AsBlankNode(destinationAirport.NodeId));
            }

            if (carriers.TryGetValue(flight.Carrier, out CarrierDto carrier))
            {
                triples.Add(nodeFactory.AsUriNode(Constants.Predicates.HasCarrier), nodeFactory.AsBlankNode(carrier.NodeId));
            }

            return(triples.Build());
        }