示例#1
0
        public static SparqlQuery CreateQuery(QueryTemplates template, string subjectIri)
        {
            SparqlParameterizedString queryParamString = GetQueryTemplateCopy(template);

            queryParamString.SetSubject(subjectIri);
            return(QueryParsing.ParseQuery(queryParamString));
        }
示例#2
0
        public static SparqlParameterizedString GetQueryTemplateCopy(QueryTemplates template)
        {
            switch (template)
            {
            //case QueryTemplates.SelectPredicateObjectOfSubject:
            //return new SparqlParameterizedString(selectPredicateObjectOfSubject);
            case QueryTemplates.SelectDistinctPredicateOfSubject:
                return(new SparqlParameterizedString(selectDistinctPredicateOfSubject));

            case QueryTemplates.SelectDistinctPredicateAndObjectCount:
                return(new SparqlParameterizedString(selectDistinctPredicateAndObjectCount));

            case QueryTemplates.SelectPopularProperties:
                return(new SparqlParameterizedString(selectPopularProperties));

            //case QueryTemplates.SelectFilterPredicatesFilterLanguage:
            //return new SparqlParameterizedString(selectFilterPredicatesFilterLanguage);
            case QueryTemplates.SelectObjectsOfPredicate:
                return(new SparqlParameterizedString(selectObjectsOfPredicate));

            case QueryTemplates.SelectObjectsOfPredicateWithLimit:
                return(new SparqlParameterizedString(selectObjectsOfPredicateWithLimit));

            default:
                return(null);
            }
        }
        public FormAddComanyAnadPostToWorker()
        {
            InitializeComponent();

            Context db = new Context();

            _qt = new QueryTemplates(db);
        }
示例#4
0
文件: FormWorker.cs 项目: breshch/AIS
        public FormWorker()
        {
            InitializeComponent();

            Context db = new Context();

            _qt = new QueryTemplates(db);
        }
示例#5
0
        private void FormNameOfCompany_Load(object sender, EventArgs e)
        {
            var db = new Context();

            _qt = new QueryTemplates(db);

            FormFill();
            comboBoxTypeOfCompanies.Items.AddRange(_qt.GetDirectoryTypeOfCompanyNames().ToArray());
        }
示例#6
0
        private void FormTypeOfCompany_Load(object sender, EventArgs e)
        {
            var db = new Context();

            _qt = new QueryTemplates(db);

            listBoxTypeOfCompanies.Items.Clear();
            FormFill();
        }
示例#7
0
        private void FormPost_Load(object sender, EventArgs e)
        {
            var db = new Context();

            _qt = new QueryTemplates(db);

            comboBoxNameOfCompany.Items.AddRange(_qt.GetDirectoryCompanyNames().ToArray());
            comboBoxTypeOfPost.Items.AddRange(_qt.GetDirectoryTypeOfPostNames().ToArray());
            dateTimePickerDate.MaxDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddDays(1).AddSeconds(-1);

            AddRows();
        }
        public void GenerateQueryString()
        {
            string queryString;

            int primaryDbAreaType =
                AreaTypeMappings.GetPrimaryDatabaseAreaType(
                    this.GroupByAreaTypeIdIs);

            if (!this.AvailableAreaTypes.Contains(primaryDbAreaType))
            {
                throw new Exception(
                          "Supplied grouping areaType not suitable for this statistics data!");
            }

            Debug.WriteLine(string.Format(
                                "We have these areaTypes available: [{0}]",
                                string.Join(",", this.AvailableAreaTypes)));

            if (this.CalculationTypeIdIs != 4)
            {
                string errMsg = string.Format(
                    "Unsupported CalculationType: {0}",
                    this.CalculationTypeIdIs);
                logger.Error(errMsg);
                throw new Exception(errMsg);
            }

            this.fields.Add("T.Jakso_ID AS Year");
            this.fields.Add("COALESCE(T.Arvo, 0) AS Value");

            this.SetFilters();
            this.SetGroups(); // nothing should be grouped in this query
            this.SetDatabaseAreaTypeId();

            queryString = QueryTemplates.Get("Normal");
            queryString = string.Format(queryString,
                                        this.GetFieldsString(),
                                        this.GetFromString(),
                                        this.GetWhereString(),
                                        "/* group string omitted */",
                                        this.GetOrderString(),
                                        this.GetFilterJoinsString(),
                                        this.GetAreaYearField());

            /* preQuery stuff (which are geometry declarations at the moment)
             * should be common for all query types, let's prepend it here */
            queryString = this.GetPreQueryString() + "\n" + queryString;

            /* postQuery stuff (drop temporary tables) */
            queryString = queryString + "\n" + this.GetPostQueryString();

            this.QueryString = queryString;
        }
示例#9
0
        /// <summary>
        /// Called when a data object is selected.
        /// </summary>
        private void OnDataObjectSelected()
        {
            if (DataObject == null || DataObject == QueryTemplateText)
            {
                return;
            }

            var template = QueryTemplates.GetTemplate(DataObject, "WITSML", Model.WitsmlVersion, Model.ReturnElementType);

            XmlQuery.SetText(template.ToString(SaveOptions.OmitDuplicateNamespaces));

            // Reset drop down list
            Runtime.InvokeAsync(() => DataObject = QueryTemplateText);
        }