public void OntologyPropertyTopAndBottom() { //Load Test Data Console.WriteLine("Loading in the standard test data InferenceTest.ttl"); OntologyGraph g = new OntologyGraph(); FileLoader.Load(g, "InferenceTest.ttl"); //Get the property Speed OntologyProperty speed = g.CreateOntologyProperty(new Uri("http://example.org/vehicles/Speed")); Assert.IsTrue(speed.IsTopProperty); Assert.IsFalse(speed.IsBottomProperty); //Get the property AirSpeed OntologyProperty airSpeed = g.CreateOntologyProperty(new Uri("http://example.org/vehicles/AirSpeed")); Assert.IsFalse(airSpeed.IsTopProperty); Assert.IsTrue(airSpeed.IsBottomProperty); }
public void OntologyPropertySubProperties() { //Load Test Data Console.WriteLine("Loading in the standard test data InferenceTest.ttl"); OntologyGraph g = new OntologyGraph(); FileLoader.Load(g, "InferenceTest.ttl"); //Get the property of Ground Speed OntologyProperty groundSpeed = g.CreateOntologyProperty(new Uri("http://example.org/vehicles/GroundSpeed")); //Check counts of super properties Assert.AreEqual(1, groundSpeed.SuperProperties.Count()); Assert.AreEqual(1, groundSpeed.DirectSuperProperties.Count()); Assert.AreEqual(0, groundSpeed.IndirectSuperProperty.Count()); //Check counts of sub-properties OntologyProperty speed = g.CreateOntologyProperty(new Uri("http://example.org/vehicles/Speed")); Assert.AreEqual(3, speed.SubProperties.Count()); Assert.AreEqual(3, speed.DirectSubProperties.Count()); Assert.AreEqual(0, speed.IndirectSubProperties.Count()); }
public void OntologyPropertySiblings() { //Load Test Data Console.WriteLine("Loading in the standard test data InferenceTest.ttl"); OntologyGraph g = new OntologyGraph(); FileLoader.Load(g, "InferenceTest.ttl"); //Get the property LimitedSpeed OntologyProperty limitedSpeed = g.CreateOntologyProperty(new Uri("http://example.org/vehicles/LimitedSpeed")); //Get siblings List <OntologyProperty> siblings = limitedSpeed.Siblings.ToList(); Assert.AreEqual(2, siblings.Count); Assert.IsFalse(siblings.Contains(limitedSpeed)); }
public void OntologyPropertyBasic() { //Load Test Data Console.WriteLine("Loading in the standard test data InferenceTest.ttl"); OntologyGraph g = new OntologyGraph(); FileLoader.Load(g, "InferenceTest.ttl"); OntologyProperty speed = g.CreateOntologyProperty(new Uri("http://example.org/vehicles/Speed")); Console.WriteLine("Ranges"); foreach (OntologyClass c in speed.Ranges) { Console.WriteLine(c.Resource.ToString()); } Console.WriteLine("Domains"); foreach (OntologyClass c in speed.Domains) { Console.WriteLine(c.Resource.ToString()); } Console.WriteLine("Sub-properties"); foreach (OntologyProperty p in speed.SubProperties) { Console.WriteLine(p.Resource.ToString()); } Console.WriteLine("Super-properties"); foreach (OntologyProperty p in speed.SuperProperties) { Console.WriteLine(p.Resource.ToString()); } Console.WriteLine(); Console.WriteLine("Used By"); foreach (OntologyResource r in speed.UsedBy) { Console.WriteLine(r.Resource.ToString()); } }