Пример #1
0
        public void TestMapDefaults()
        {
            var map = new SparqlMap("dbpedia.metadata",
                                    "http://dbpedia.org/ontology/", NameMapping.UpperCamelCase,
                                    "http://dbpedia.org/property/", NameMapping.LowerCamelCase);

            Assert.AreEqual("http://www.w3.org/2002/07/owl#Thing", map.GetUriForType("DBPedia.Thing"));
            Assert.AreEqual("http://dbpedia.org/ontology/Work", map.GetUriForType("DBPedia.Work"));
            Assert.AreEqual("http://dbpedia.org/ontology/Film", map.GetUriForType("DBPedia.Film"));
            Assert.AreEqual("http://dbpedia.org/ontology/Place", map.GetUriForType("DBPedia.Place"));
            Assert.AreEqual("http://dbpedia.org/property/elevation", map.GetUriForProperty("DBPedia.Place", "Elevation"));
            Assert.AreEqual("http://dbpedia.org/property/annualTemperature", map.GetUriForProperty("DBPedia.Place", "AnnualTemperature"));
        }
Пример #2
0
 public void TestReadPropertyUriAnnotation()
 {
     var map = new SparqlMap("dbpedia.metadata", 
         "http://dbpedia.org/ontology/", NameMapping.Unchanged,
         "http://dbpedia.org/property/name", NameMapping.LowerCamelCase);
     Assert.AreEqual("http://dbpedia.org/property/name", map.GetUriForProperty("DBPedia.Film", "Name"));
 }
Пример #3
0
        public void TestReadPropertyUriAnnotation()
        {
            var map = new SparqlMap("dbpedia.metadata",
                                    "http://dbpedia.org/ontology/", NameMapping.Unchanged,
                                    "http://dbpedia.org/property/name", NameMapping.LowerCamelCase);

            Assert.AreEqual("http://dbpedia.org/property/name", map.GetUriForProperty("DBPedia.Film", "Name"));
        }
Пример #4
0
        public void TestIdPropertyMapping()
        {
            var map = new SparqlMap("dbpedia.metadata",
                                    "http://dbpedia.org/ontology/", NameMapping.UpperCamelCase,
                                    "http://dbpedia.org/property/", NameMapping.LowerCase);

            Assert.IsNull(map.GetUriForProperty("DBPedia.Thing", "Id"));
            Assert.IsNull(map.GetUriForProperty("DBPedia.Film", "Id"));
            Assert.IsFalse(map.GetStructuralPropertyMappings("DBPedia.Thing").Any(m => m.Name.Equals("Id")));
            Assert.IsFalse(map.GetStructuralPropertyMappings("DBPedia.Film").Any(m => m.Name.Equals("Id")));

            var idMapping = map.GetIdentifierPropertyMapping("DBPedia.Thing");

            Assert.IsNotNull(idMapping);
            Assert.AreEqual("http://dbpedia.org/resource/", idMapping.IdentifierPrefix);
            Assert.AreEqual("Id", idMapping.Name);

            idMapping = map.GetIdentifierPropertyMapping("DBPedia.Film");
            Assert.IsNotNull(idMapping);
            Assert.AreEqual("http://dbpedia.org/resource/", idMapping.IdentifierPrefix);
            Assert.AreEqual("Id", idMapping.Name);
        }
Пример #5
0
        public void TestIdPropertyMapping()
        {
            var map = new SparqlMap("dbpedia.metadata",
                                    "http://dbpedia.org/ontology/", NameMapping.UpperCamelCase,
                                    "http://dbpedia.org/property/", NameMapping.LowerCase);
            Assert.IsNull(map.GetUriForProperty("DBPedia.Thing", "Id"));
            Assert.IsNull(map.GetUriForProperty("DBPedia.Film", "Id"));
            Assert.IsFalse(map.GetStructuralPropertyMappings("DBPedia.Thing").Any(m => m.Name.Equals("Id")));
            Assert.IsFalse(map.GetStructuralPropertyMappings("DBPedia.Film").Any(m=>m.Name.Equals("Id")));

            var idMapping = map.GetIdentifierPropertyMapping("DBPedia.Thing");
            Assert.IsNotNull(idMapping);
            Assert.AreEqual("http://dbpedia.org/resource/", idMapping.IdentifierPrefix);
            Assert.AreEqual("Id", idMapping.Name);

            idMapping = map.GetIdentifierPropertyMapping("DBPedia.Film");
            Assert.IsNotNull(idMapping);
            Assert.AreEqual("http://dbpedia.org/resource/", idMapping.IdentifierPrefix);
            Assert.AreEqual("Id", idMapping.Name);
        }
Пример #6
0
 public void TestMapDefaults()
 {
     var map = new SparqlMap("dbpedia.metadata",
                             "http://dbpedia.org/ontology/", NameMapping.UpperCamelCase,
                             "http://dbpedia.org/property/", NameMapping.LowerCamelCase);
     Assert.AreEqual("http://www.w3.org/2002/07/owl#Thing", map.GetUriForType("DBPedia.Thing"));
     Assert.AreEqual("http://dbpedia.org/ontology/Work", map.GetUriForType("DBPedia.Work"));
     Assert.AreEqual("http://dbpedia.org/ontology/Film", map.GetUriForType("DBPedia.Film"));
     Assert.AreEqual("http://dbpedia.org/ontology/Place", map.GetUriForType("DBPedia.Place"));
     Assert.AreEqual("http://dbpedia.org/property/elevation", map.GetUriForProperty("DBPedia.Place", "Elevation"));
     Assert.AreEqual("http://dbpedia.org/property/annualTemperature", map.GetUriForProperty("DBPedia.Place", "AnnualTemperature"));
 }