/// <summary>
 /// Checks if the given childproperty can be set subPropertyOf the given motherproperty;<br/>
 /// Does not accept property chain definitions, for OWL2-DL decidability preservation.
 /// </summary>
 internal static bool CheckSubPropertyOfCompatibility(RDFOntologyPropertyModel propertyModel, RDFOntologyObjectProperty childProperty, RDFOntologyObjectProperty motherProperty)
 => !propertyModel.CheckIsSubPropertyOf(motherProperty, childProperty) &&
 !propertyModel.CheckIsEquivalentPropertyOf(motherProperty, childProperty) &&
 !propertyModel.CheckIsPropertyDisjointWith(motherProperty, childProperty) &&
 //OWL2-DL decidability
 !propertyModel.CheckIsPropertyChain(childProperty) &&
 !propertyModel.CheckIsPropertyChain(motherProperty);
 /// <summary>
 /// Checks if the given aproperty can be set equivalentpropertyof the given bproperty
 /// </summary>
 internal static Boolean CheckEquivalentPropertyCompatibility(RDFOntologyPropertyModel propertyModel,
                                                              RDFOntologyDatatypeProperty aProperty,
                                                              RDFOntologyDatatypeProperty bProperty)
 {
     return(!propertyModel.CheckIsSubPropertyOf(aProperty, bProperty) &&
            !propertyModel.CheckIsSuperPropertyOf(aProperty, bProperty));
 }
 /// <summary>
 /// Checks if the given aProperty can be set equivalentPropertyOf the given bProperty;<br/>
 /// Does not accept property chain definitions, for OWL2-DL decidability preservation.
 /// </summary>
 internal static bool CheckEquivalentPropertyCompatibility(RDFOntologyPropertyModel propertyModel, RDFOntologyObjectProperty aProperty, RDFOntologyObjectProperty bProperty)
 => !propertyModel.CheckIsSubPropertyOf(aProperty, bProperty) &&
 !propertyModel.CheckIsSuperPropertyOf(aProperty, bProperty) &&
 !propertyModel.CheckIsPropertyDisjointWith(aProperty, bProperty) &&
 //OWL2-DL decidability
 !propertyModel.CheckIsPropertyChain(aProperty) &&
 !propertyModel.CheckIsPropertyChain(bProperty);
 /// <summary>
 /// Checks if the given childproperty can be set subpropertyof the given motherproperty
 /// </summary>
 internal static Boolean CheckSubPropertyOfCompatibility(RDFOntologyPropertyModel propertyModel,
                                                         RDFOntologyDatatypeProperty childProperty,
                                                         RDFOntologyDatatypeProperty motherProperty)
 {
     return(!propertyModel.CheckIsSubPropertyOf(motherProperty, childProperty) &&
            !propertyModel.CheckIsEquivalentPropertyOf(motherProperty, childProperty));
 }
        /// <summary>
        /// Enlists the equivalentProperties of the given property within the given property model
        /// </summary>
        public static RDFOntologyPropertyModel EnlistEquivalentPropertiesOf(RDFOntologyProperty ontProperty,
                                                                            RDFOntologyPropertyModel propertyModel)
        {
            var result = new RDFOntologyPropertyModel();

            if (ontProperty != null && propertyModel != null)
            {
                result = RDFSemanticsUtilities.EnlistEquivalentPropertiesOf_Core(ontProperty, propertyModel, null)
                         .RemoveProperty(ontProperty);                              //Safety deletion
            }
            return(result);
        }
        /// <summary>
        /// Enlists the super properties of the given property within the given property model
        /// </summary>
        public static RDFOntologyPropertyModel EnlistSuperPropertiesOf(RDFOntologyProperty ontProperty,
                                                                       RDFOntologyPropertyModel propertyModel)
        {
            var result = new RDFOntologyPropertyModel();

            if (ontProperty != null && propertyModel != null)
            {
                //Step 1: Reason on the given property
                result = RDFSemanticsUtilities.EnlistSuperPropertiesOf_Core(ontProperty, propertyModel);

                //Step 2: Reason on the equivalent properties
                foreach (var ep in EnlistEquivalentPropertiesOf(ontProperty, propertyModel))
                {
                    result = result.UnionWith(RDFSemanticsUtilities.EnlistSuperPropertiesOf_Core(ep, propertyModel));
                }
            }
            return(result);
        }
        /// <summary>
        /// Enlists the inverse properties of the given property within the given property model
        /// </summary>
        public static RDFOntologyPropertyModel EnlistInversePropertiesOf(RDFOntologyObjectProperty ontProperty,
                                                                         RDFOntologyPropertyModel propertyModel)
        {
            var result = new RDFOntologyPropertyModel();

            if (ontProperty != null && propertyModel != null)
            {
                //Step 1: Reason on the given property
                //Subject-side inverseOf relation
                foreach (var invOf     in propertyModel.Relations.InverseOf.SelectEntriesBySubject(ontProperty))
                {
                    result.AddProperty((RDFOntologyObjectProperty)invOf.TaxonomyObject);
                }
                //Object-side inverseOf relation
                foreach (var invOf    in propertyModel.Relations.InverseOf.SelectEntriesByObject(ontProperty))
                {
                    result.AddProperty((RDFOntologyObjectProperty)invOf.TaxonomySubject);
                }
                result.RemoveProperty(ontProperty); //Safety deletion
            }
            return(result);
        }
 /// <summary>
 /// Checks if the given aProperty can be set equivalentPropertyOf the given bProperty
 /// </summary>
 internal static bool CheckEquivalentPropertyCompatibility(RDFOntologyPropertyModel propertyModel, RDFOntologyDatatypeProperty aProperty, RDFOntologyDatatypeProperty bProperty)
 => !propertyModel.CheckIsSubPropertyOf(aProperty, bProperty) &&
 !propertyModel.CheckIsSuperPropertyOf(aProperty, bProperty) &&
 !propertyModel.CheckIsPropertyDisjointWith(aProperty, bProperty);
Пример #9
0
 /// <summary>
 /// Default-ctor to build an empty ontology model
 /// </summary>
 public RDFOntologyModel()
 {
     this.ClassModel    = new RDFOntologyClassModel();
     this.PropertyModel = new RDFOntologyPropertyModel();
 }
 /// <summary>
 /// Checks if the given childproperty can be set subPropertyOf the given motherproperty
 /// </summary>
 internal static bool CheckSubPropertyOfCompatibility(RDFOntologyPropertyModel propertyModel, RDFOntologyDatatypeProperty childProperty, RDFOntologyDatatypeProperty motherProperty)
 => !propertyModel.CheckIsSubPropertyOf(motherProperty, childProperty) &&
 !propertyModel.CheckIsEquivalentPropertyOf(motherProperty, childProperty) &&
 !propertyModel.CheckIsPropertyDisjointWith(motherProperty, childProperty);
Пример #11
0
        /// <summary>
        /// Subsumes the "owl:equivalentProperty" taxonomy to discover direct and indirect equivalentProperties of the given property
        /// </summary>
        internal static RDFOntologyPropertyModel EnlistEquivalentPropertiesOf_Core(RDFOntologyProperty ontProperty,
                                                                                   RDFOntologyPropertyModel propertyModel,
                                                                                   Dictionary<Int64, RDFOntologyProperty> visitContext) {
            var result        = new RDFOntologyPropertyModel();

            #region visitContext
            if (visitContext == null) {
                visitContext  = new Dictionary<Int64, RDFOntologyProperty>() { { ontProperty.PatternMemberID, ontProperty } };
            }
            else {
                if (!visitContext.ContainsKey(ontProperty.PatternMemberID)) {
                     visitContext.Add(ontProperty.PatternMemberID, ontProperty);
                }
                else {
                    return result;
                }
            }
            #endregion

            // Transitivity of "owl:equivalentProperty" taxonomy: ((A EQUIVALENTPROPERTY B)  &&  (B EQUIVALENTPROPERTY C))  =>  (A EQUIVALENTPROPERTY C)
            foreach (var      ep in propertyModel.Relations.EquivalentProperty.SelectEntriesBySubject(ontProperty)) {
                result.AddProperty((RDFOntologyProperty)ep.TaxonomyObject);
                result        = result.UnionWith(RDFSemanticsUtilities.EnlistEquivalentPropertiesOf_Core((RDFOntologyProperty)ep.TaxonomyObject, propertyModel, visitContext));
            }

            return result;
        }
Пример #12
0
        internal static RDFOntologyPropertyModel EnlistSuperPropertiesOf_Core(RDFOntologyProperty ontProperty, RDFOntologyPropertyModel propertyModel) {
            var result1 = new RDFOntologyPropertyModel();
            var result2 = new RDFOntologyPropertyModel();

            // Step 1: Direct subsumption of "rdfs:subPropertyOf" taxonomy
            result1     = RDFSemanticsUtilities.EnlistSuperPropertiesOf(ontProperty, propertyModel);

            // Step 2: Enlist equivalent properties of subproperties
            result2     = result2.UnionWith(result1);
            foreach(var sp in result1) {
                result2 = result2.UnionWith(RDFOntologyReasoningHelper.EnlistEquivalentPropertiesOf(sp, propertyModel)
                                                .UnionWith(RDFOntologyReasoningHelper.EnlistSuperPropertiesOf(sp, propertyModel)));
            }

            return result2;
        }
        /// <summary>
        /// Enlists the super properties of the given property within the given property model
        /// </summary>
        public static RDFOntologyPropertyModel EnlistSuperPropertiesOf(RDFOntologyProperty ontProperty, RDFOntologyPropertyModel propertyModel) {
            var result         = new RDFOntologyPropertyModel();
            if(ontProperty    != null && propertyModel != null) {

                //Step 1: Reason on the given property
                result         = RDFSemanticsUtilities.EnlistSuperPropertiesOf_Core(ontProperty, propertyModel);

                //Step 2: Reason on the equivalent properties of the given property
                foreach(var   ep in RDFOntologyReasoningHelper.EnlistEquivalentPropertiesOf(ontProperty, propertyModel)) {
                    result     = result.UnionWith(RDFSemanticsUtilities.EnlistSuperPropertiesOf_Core(ep, propertyModel));
                }

            }
            return result;
        }
 /// <summary>
 /// Checks if the given aProperty is inverse property of the given bProperty within the given property model
 /// </summary>
 public static Boolean IsInversePropertyOf(RDFOntologyObjectProperty aProperty,
                                           RDFOntologyObjectProperty bProperty,
                                           RDFOntologyPropertyModel propertyModel)
 {
     return(aProperty != null && bProperty != null && propertyModel != null ? EnlistInversePropertiesOf(aProperty, propertyModel).Properties.ContainsKey(bProperty.PatternMemberID) : false);
 }
 /// <summary>
 /// Enlists the equivalentProperties of the given property within the given property model
 /// </summary>
 public static RDFOntologyPropertyModel EnlistEquivalentPropertiesOf(RDFOntologyProperty ontProperty, RDFOntologyPropertyModel propertyModel) {
     var result         = new RDFOntologyPropertyModel();
     if (ontProperty   != null && propertyModel != null) {
         result         = RDFSemanticsUtilities.EnlistEquivalentPropertiesOf_Core(ontProperty, propertyModel, null).RemoveProperty(ontProperty);
     }
     return result;
 }
Пример #16
0
 /// <summary>
 /// Default-ctor to build an empty ontology model
 /// </summary>
 public RDFOntologyModel() {
     this.ClassModel    = new RDFOntologyClassModel();
     this.PropertyModel = new RDFOntologyPropertyModel();
 }
        /// <summary>
        /// Enlists the inverse properties of the given property within the given property model
        /// </summary>
        public static RDFOntologyPropertyModel EnlistInversePropertiesOf(RDFOntologyObjectProperty ontProperty, RDFOntologyPropertyModel propertyModel) {
            var result              = new RDFOntologyPropertyModel();
            if (ontProperty        != null && propertyModel != null) {
                
                //Subject-side inverseOf relation
                foreach (var invOf in propertyModel.Relations.InverseOf.SelectEntriesBySubject(ontProperty)) {
                    result.AddProperty((RDFOntologyObjectProperty)invOf.TaxonomyObject);
                }

                //Object-side inverseOf relation
                foreach (var invOf in propertyModel.Relations.InverseOf.SelectEntriesByObject(ontProperty)) {
                    result.AddProperty((RDFOntologyObjectProperty)invOf.TaxonomySubject);
                }

                result.RemoveProperty(ontProperty); //Safety deletion
            }
            return result;
        }
 /// <summary>
 /// Checks if the given aProperty is inverse property of the given bProperty within the given property model
 /// </summary>
 public static Boolean IsInversePropertyOf(RDFOntologyObjectProperty aProperty, RDFOntologyObjectProperty bProperty, RDFOntologyPropertyModel propertyModel) {
     return (aProperty != null && bProperty != null && propertyModel != null ? RDFOntologyReasoningHelper.EnlistInversePropertiesOf(aProperty, propertyModel).Properties.ContainsKey(bProperty.PatternMemberID) : false);
 }
 /// <summary>
 /// Checks if the given aProperty can be set inverseOf the given bProperty
 /// </summary>
 internal static bool CheckInverseOfPropertyCompatibility(RDFOntologyPropertyModel propertyModel, RDFOntologyObjectProperty aProperty, RDFOntologyObjectProperty bProperty)
 => !propertyModel.CheckIsSubPropertyOf(aProperty, bProperty) &&
 !propertyModel.CheckIsSuperPropertyOf(aProperty, bProperty) &&
 !propertyModel.CheckIsEquivalentPropertyOf(aProperty, bProperty);
Пример #20
0
        /// <summary>
        /// Subsumes the "rdfs:subPropertyOf" taxonomy to discover direct and indirect superProperties of the given property
        /// </summary>
        internal static RDFOntologyPropertyModel EnlistSuperPropertiesOf(RDFOntologyProperty ontProperty, RDFOntologyPropertyModel propertyModel) {
            var result  = new RDFOntologyPropertyModel();

            // Transitivity of "rdfs:subPropertyOf" taxonomy: ((A SUPERPROPERTYOF B)  &&  (B SUPERPROPERTYOF C))  =>  (A SUPERPROPERTYOF C)
            foreach(var sp in propertyModel.Relations.SubPropertyOf.SelectEntriesBySubject(ontProperty)) {
                result.AddProperty((RDFOntologyProperty)sp.TaxonomyObject);
                result  = result.UnionWith(RDFSemanticsUtilities.EnlistSuperPropertiesOf((RDFOntologyProperty)sp.TaxonomyObject, propertyModel));
            }

            return result;
        }