コード例 #1
0
        public void TestCreatePropertyIndexAndMapResults()
        {
            const string filename            = "Resources/PropertyIndex5k.nt";
            const string propertiesIndexPath = "CreatePropertyIndexMapResults";
            const string entitiesIndexPath   = "CreatePropertyIndexMapResults-EntitiesIndex";

            propertiesIndexPath.DeleteIfExists();
            entitiesIndexPath.DeleteIfExists();

            new EntitiesIndexer(filename, entitiesIndexPath).Index();
            new PropertiesIndexer(filename, propertiesIndexPath, entitiesIndexPath).Index();

            Assert.True(Directory.Exists(propertiesIndexPath));

            var queryCity = new SingleLabelPropertyQuery(propertiesIndexPath, "located").Query().ToArray();

            Assert.NotEmpty(queryCity);
            var result = queryCity[0];

            Assert.Equal("P131", result.Id);
            Assert.Equal("located in the administrative territorial entity", result.Label);
            Assert.Equal("the item is located on the territory of the following administrative entity...",
                         result.Description);
            Assert.Contains("is located in", result.AltLabels);
            Assert.Contains("is in the county of", result.AltLabels);
            Assert.Contains("is in the city of", result.AltLabels);
            Assert.NotEqual(0, result.Rank);

            propertiesIndexPath.DeleteIfExists();
            entitiesIndexPath.DeleteIfExists();
        }
コード例 #2
0
        public void TestQueryNonExistingPropertyByLabel()
        {
            const string indexPath = "Resources/IndexSingle";
            var          actual    = new SingleLabelPropertyQuery(indexPath, "Non-Existing").Query();

            Assert.Empty(actual);
        }