Пример #1
0
 /// <summary>
 /// Adds the "aFact -> objectProperty -> bFact" relation to the data
 /// </summary>
 public RDFOntologyData AddAssertionRelation(RDFOntologyFact aFact,
                                             RDFOntologyObjectProperty objectProperty,
                                             RDFOntologyFact bFact)
 {
     if (aFact != null && objectProperty != null && bFact != null)
     {
         //Enforce preliminary check on usage of BASE properties
         if (!RDFOntologyChecker.CheckReservedProperty(objectProperty))
         {
             //Enforce taxonomy checks before adding the assertion
             //Creation of transitive cycles is not allowed (OWL-DL)
             if (RDFOntologyChecker.CheckTransitiveAssertionCompatibility(this, aFact, objectProperty, bFact))
             {
                 this.Relations.Assertions.AddEntry(new RDFOntologyTaxonomyEntry(aFact, objectProperty, bFact));
             }
             else
             {
                 //Raise warning event to inform the user: Assertion relation cannot be added to the data because it violates the taxonomy transitive consistency
                 RDFSemanticsEvents.RaiseSemanticsWarning(String.Format("Assertion relation between fact '{0}' and fact '{1}' with transitive property '{2}' cannot be added to the data because it would violate the taxonomy consistency (transitive cycle detected).", aFact, bFact, objectProperty));
             }
         }
         else
         {
             //Raise warning event to inform the user: Assertion relation cannot be added to the data because usage of BASE reserved properties compromises the taxonomy consistency
             RDFSemanticsEvents.RaiseSemanticsWarning(String.Format("Assertion relation between fact '{0}' and fact '{1}' cannot be added to the data because usage of BASE reserved properties compromises the taxonomy consistency.", aFact, bFact));
         }
     }
     return(this);
 }
Пример #2
0
 /// <summary>
 /// Checks if the given "aFact -> objectProperty -> bFact" has transitive assertions
 /// which would cause transitive cycles (unallowed concept in OWL-DL)
 /// </summary>
 internal static Boolean CheckTransitiveAssertionCompatibility(RDFOntologyData ontologyData,
                                                               RDFOntologyFact aFact,
                                                               RDFOntologyObjectProperty objectProperty,
                                                               RDFOntologyFact bFact)
 {
     return(!ontologyData.CheckIsTransitiveAssertionOf(bFact, objectProperty, aFact));
 }
Пример #3
0
 /// <summary>
 /// Checks if the given childproperty can be set subpropertyof the given motherproperty
 /// </summary>
 internal static Boolean CheckSubPropertyOfCompatibility(RDFOntologyPropertyModel propertyModel,
                                                         RDFOntologyObjectProperty childProperty,
                                                         RDFOntologyObjectProperty motherProperty)
 {
     return(!propertyModel.CheckIsSubPropertyOf(motherProperty, childProperty) &&
            !propertyModel.CheckIsEquivalentPropertyOf(motherProperty, childProperty));
 }
Пример #4
0
 /// <summary>
 /// Checks if the given aproperty can be set equivalentpropertyof the given bproperty
 /// </summary>
 internal static Boolean CheckEquivalentPropertyCompatibility(RDFOntologyPropertyModel propertyModel,
                                                              RDFOntologyObjectProperty aProperty,
                                                              RDFOntologyObjectProperty bProperty)
 {
     return(!propertyModel.CheckIsSubPropertyOf(aProperty, bProperty) &&
            !propertyModel.CheckIsSuperPropertyOf(aProperty, bProperty));
 }
Пример #5
0
 /// <summary>
 /// Removes the "aFact -> objectProperty -> bFact" relation from the data
 /// </summary>
 public RDFOntologyData RemoveAssertionRelation(RDFOntologyFact aFact,
                                                RDFOntologyObjectProperty objectProperty,
                                                RDFOntologyFact bFact)
 {
     if (aFact != null && objectProperty != null && bFact != null)
     {
         this.Relations.Assertions.RemoveEntry(new RDFOntologyTaxonomyEntry(aFact, objectProperty, bFact));
     }
     return(this);
 }