Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds the "ontologyFact -> rdf:type -> ontologyClass" relation to the data.
 /// </summary>
 public RDFOntologyData AddClassTypeRelation(RDFOntologyFact ontologyFact,
                                             RDFOntologyClass ontologyClass)
 {
     if (ontologyFact != null && ontologyClass != null)
     {
         //Enforce preliminary check on usage of BASE classes
         if (!RDFOntologyChecker.CheckReservedClass(ontologyClass))
         {
             //Enforce taxonomy checks before adding the ClassType relation
             if (RDFOntologyChecker.CheckClassTypeCompatibility(ontologyClass))
             {
                 this.Relations.ClassType.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDF.TYPE.ToRDFOntologyObjectProperty(), ontologyClass));
             }
             else
             {
                 //Raise warning event to inform the user: ClassType relation cannot be added to the data because only plain classes can be explicitly assigned as class types of facts
                 RDFSemanticsEvents.RaiseSemanticsWarning(String.Format("ClassType relation between fact '{0}' and class '{1}' cannot be added to the data because only plain classes can be explicitly assigned as class types of facts.", ontologyFact, ontologyClass));
             }
         }
         else
         {
             //Raise warning event to inform the user: ClassType relation cannot be added to the data because usage of BASE reserved classes compromises the taxonomy consistency
             RDFSemanticsEvents.RaiseSemanticsWarning(String.Format("ClassType relation between fact '{0}' and class '{1}' cannot be added to the data because because usage of BASE reserved classes compromises the taxonomy consistency.", ontologyFact, ontologyClass));
         }
     }
     return(this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the "aFact -> owl:differentFrom -> bFact" relation to the data
 /// </summary>
 public RDFOntologyData AddDifferentFromRelation(RDFOntologyFact aFact,
                                                 RDFOntologyFact bFact)
 {
     if (aFact != null && bFact != null && !aFact.Equals(bFact))
     {
         //Enforce taxonomy checks before adding the DifferentFrom relation
         if (RDFOntologyChecker.CheckDifferentFromCompatibility(this, aFact, bFact))
         {
             this.Relations.DifferentFrom.AddEntry(new RDFOntologyTaxonomyEntry(aFact, RDFVocabulary.OWL.DIFFERENT_FROM.ToRDFOntologyObjectProperty(), bFact));
             this.Relations.DifferentFrom.AddEntry(new RDFOntologyTaxonomyEntry(bFact, RDFVocabulary.OWL.DIFFERENT_FROM.ToRDFOntologyObjectProperty(), aFact).SetInference(RDFSemanticsEnums.RDFOntologyInferenceType.API));
         }
         else
         {
             //Raise warning event to inform the user: DifferentFrom relation cannot be added to the data because it violates the taxonomy consistency
             RDFSemanticsEvents.RaiseSemanticsWarning(String.Format("DifferentFrom relation between fact '{0}' and fact '{1}' cannot be added to the data because it violates the taxonomy consistency.", aFact, bFact));
         }
     }
     return(this);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds the "ontologyFact -> datatypeProperty -> ontologyLiteral" relation to the data
 /// </summary>
 public RDFOntologyData AddAssertionRelation(RDFOntologyFact ontologyFact,
                                             RDFOntologyDatatypeProperty datatypeProperty,
                                             RDFOntologyLiteral ontologyLiteral)
 {
     if (ontologyFact != null && datatypeProperty != null && ontologyLiteral != null)
     {
         //Enforce preliminary check on usage of BASE properties
         if (!RDFOntologyChecker.CheckReservedProperty(datatypeProperty))
         {
             this.Relations.Assertions.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, datatypeProperty, ontologyLiteral));
             this.AddLiteral(ontologyLiteral);
         }
         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 literal '{1}' cannot be added to the data because usage of BASE reserved properties compromises the taxonomy consistency.", ontologyFact, ontologyLiteral));
         }
     }
     return(this);
 }