Example #1
0
        /// <summary>
        /// Adds an inverse property for the property
        /// </summary>
        /// <param name="property">Property</param>
        /// <returns></returns>
        /// <remarks>
        /// This overload also adds this property as an inverse property of the given property
        /// </remarks>
        public bool AddInverseProperty(OntologyProperty property)
        {
            bool a = this.AddInverseProperty(property.Resource);
            bool b = property.AddInverseProperty(this._resource);

            return(a || b);
        }
Example #2
0
        /// <summary>
        /// Removes a super-property for the property
        /// </summary>
        /// <param name="property">Property</param>
        /// <returns></returns>
        /// <remarks>
        /// This overload also removes this property as a sub-property of the given property
        /// </remarks>
        public bool RemoveSuperProperty(OntologyProperty property)
        {
            bool a = this.RemoveSuperProperty(property.Resource);
            bool b = property.RemoveSubProperty(this._resource);

            return(a || b);
        }
Example #3
0
        /// <summary>
        /// Adds a super-property for the property.
        /// </summary>
        /// <param name="property">Property.</param>
        /// <returns></returns>
        /// <remarks>
        /// This overload also adds this property as a sub-property of the given property.
        /// </remarks>
        public bool AddSuperProperty(OntologyProperty property)
        {
            bool a = AddSuperProperty(property.Resource);
            bool b = property.AddSubProperty(_resource);

            return(a || b);
        }
Example #4
0
        /// <summary>
        /// Removes an inverse property for the property.
        /// </summary>
        /// <param name="property">Property.</param>
        /// <returns></returns>
        /// <remarks>
        /// This overload also removes this property as an inverse property of the given property.
        /// </remarks>
        public bool RemoveInverseProperty(OntologyProperty property)
        {
            bool a = RemoveInverseProperty(property.Resource);
            bool b = property.RemoveInverseProperty(_resource);

            return(a || b);
        }
Example #5
0
        /// <summary>
        /// Removes an equivalent property for the property.
        /// </summary>
        /// <param name="property">Property.</param>
        /// <returns></returns>
        /// <remarks>
        /// This overload also removes this property as an equivalent property of the given property.
        /// </remarks>
        public bool RemoveEquivalentProperty(OntologyProperty property)
        {
            bool a = RemoveEquivalentProperty(property.Resource);
            bool b = property.RemoveEquivalentProperty(_resource);

            return(a || b);
        }
Example #6
0
        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));
        }
Example #7
0
        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);
        }
Example #8
0
        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());
        }
Example #9
0
        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());
            }
        }
Example #10
0
 /// <summary>
 /// Removes a super-property for the property
 /// </summary>
 /// <param name="property">Property</param>
 /// <returns></returns>
 /// <remarks>
 /// This overload also removes this property as a sub-property of the given property
 /// </remarks>
 public bool RemoveSuperProperty(OntologyProperty property)
 {
     bool a = this.RemoveSuperProperty(property.Resource);
     bool b = property.RemoveSubProperty(this._resource);
     return (a || b);
 }
Example #11
0
 /// <summary>
 /// Adds an inverse property for the property
 /// </summary>
 /// <param name="property">Property</param>
 /// <returns></returns>
 /// <remarks>
 /// This overload also adds this property as an inverse property of the given property
 /// </remarks>
 public bool AddInverseProperty(OntologyProperty property)
 {
     bool a = this.AddInverseProperty(property.Resource);
     bool b = property.AddInverseProperty(this._resource);
     return (a || b);
 }