コード例 #1
0
        public SearchResultsType GetDatasets()
        {
            GeoNorge _geoNorge = new GeoNorge("", "", WebConfigurationManager.AppSettings["GeoNetworkUrl"] + geoNetworkendPoint);

            _geoNorge.OnLogEventDebug += new GeoNorgeAPI.LogEventHandlerDebug(LogEventsDebug);
            _geoNorge.OnLogEventError += new GeoNorgeAPI.LogEventHandlerError(LogEventsError);
            var filters = new object[]
            {
                new PropertyIsLikeType
                {
                    escapeChar   = "\\",
                    singleChar   = "_",
                    wildCard     = "%",
                    PropertyName = new PropertyNameType {
                        Text = new[] { "protocol" }
                    },
                    Literal = new LiteralType {
                        Text = new[] { "GEONORGE:DOWNLOAD" }
                    }
                }
            };

            var filterNames = new ItemsChoiceType23[]
            {
                ItemsChoiceType23.PropertyIsLike,
            };

            var result = _geoNorge.SearchWithFilters(filters, filterNames, 1, 1000, false);

            return(result);
        }
コード例 #2
0
        public SearchResultsType SearchMetadata(string searchString)
        {
            GeoNorge g       = new GeoNorge("", "", WebConfigurationManager.AppSettings["GeoNetworkUrl"]);
            var      filters = new object[]
            {
                new PropertyIsLikeType
                {
                    escapeChar   = "\\",
                    singleChar   = "_",
                    wildCard     = "%",
                    PropertyName = new PropertyNameType {
                        Text = new[] { "srv:title" }
                    },
                    Literal = new LiteralType {
                        Text = new[] { searchString }
                    }
                }
            };


            var filterNames = new ItemsChoiceType23[]
            {
                ItemsChoiceType23.PropertyIsLike,
            };

            var result = g.SearchWithFilters(filters, filterNames, 1, 200, true);

            return(result);
        }
コード例 #3
0
        public void ShouldReturnServicesFromKartverket()
        {
            var filters = new object[]
            {
                new BinaryLogicOpType()
                {
                    Items = new object[]
                    {
                        new PropertyIsLikeType
                        {
                            escapeChar   = "\\",
                            singleChar   = "_",
                            wildCard     = "%",
                            PropertyName = new PropertyNameType {
                                Text = new[] { "OrganisationName" }
                            },
                            Literal = new LiteralType {
                                Text = new[] { "%Kartverket%" }
                            }
                        },
                        new PropertyIsLikeType
                        {
                            PropertyName = new PropertyNameType {
                                Text = new[] { "Type" }
                            },
                            Literal = new LiteralType {
                                Text = new[] { "service" }
                            }
                        }
                    },
                    ItemsElementName = new ItemsChoiceType22[]
                    {
                        ItemsChoiceType22.PropertyIsLike, ItemsChoiceType22.PropertyIsLike,
                    }
                },
            };

            var filterNames = new ItemsChoiceType23[]
            {
                ItemsChoiceType23.And
            };

            var result = _geonorge.SearchWithFilters(filters, filterNames);

            Assert.Greater(int.Parse(result.numberOfRecordsMatched), 0, "Should have return more than zero datasets from Kartverket.");
        }
コード例 #4
0
        public SearchResultsType GetDatasets()
        {
            GeoNorge _geoNorge = new GeoNorge("", "", WebConfigurationManager.AppSettings["GeoNetworkUrl"] + geoNetworkendPoint);

            _geoNorge.OnLogEventDebug += new GeoNorgeAPI.LogEventHandlerDebug(LogEventsDebug);
            _geoNorge.OnLogEventError += new GeoNorgeAPI.LogEventHandlerError(LogEventsError);
            var filters = new object[]
            {
                new PropertyIsLikeType
                {
                    escapeChar   = "\\",
                    singleChar   = "_",
                    wildCard     = "%",
                    PropertyName = new PropertyNameType {
                        Text = new[] { "keyword" }
                    },
                    Literal = new LiteralType {
                        Text = new[] { "fellesDatakatalog" }
                    }
                }
            };

            var filterNames = new ItemsChoiceType23[]
            {
                ItemsChoiceType23.PropertyIsLike,
            };

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var result = _geoNorge.SearchWithFilters(filters, filterNames, 1, 1000, false);

            stopwatch.Stop();
            Log.Debug($"Looking up metadata from GeonorgeApi [timespent={stopwatch.ElapsedMilliseconds}ms]");
            return(result);
        }