/// <summary> /// Enlists the facts which are members of the given class within the given ontology /// </summary> public static RDFOntologyData EnlistMembersOf(RDFOntologyClass ontClass, RDFOntology ontology, Boolean useBASEOntology = true) { var result = new RDFOntologyData(); if (ontClass != null && ontology != null) { if (useBASEOntology) { ontology = ontology.UnionWith(RDFBASEOntology.Instance); } //DataRange/Literal-Compatible if (IsLiteralCompatibleClass(ontClass, ontology.Model.ClassModel)) { result = RDFSemanticsUtilities.EnlistMembersOfLiteralCompatibleClass(ontClass, ontology); } //Restriction/Composite/Enumerate/Class else { result = RDFSemanticsUtilities.EnlistMembersOfNonLiteralCompatibleClass(ontClass, ontology); } if (useBASEOntology) { ontology = ontology.DifferenceWith(RDFBASEOntology.Instance); } } return(result); }
/// <summary> /// Analyzes the given ontology and produces a detailed report of found evidences /// </summary> internal RDFOntologyValidatorReport AnalyzeOntology(RDFOntology ontology) { var report = new RDFOntologyValidatorReport(); RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Validator is going to be applied on Ontology '{0}'", ontology.Value)); //Expand ontology ontology = ontology.UnionWith(RDFBASEOntology.Instance); //Execute rules Parallel.ForEach(this.Rules, rule => { rule.ExecuteRule(ontology, report); }); //Unexpand ontology ontology = ontology.DifferenceWith(RDFBASEOntology.Instance); RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Validator has been applied on Ontology '{0}'", ontology.Value)); return(report); }
/// <summary> /// Applies the reasoner on the given ontology, producing a reasoning report. /// </summary> public RDFOntologyReasonerReport ApplyToOntology(ref RDFOntology ontology) { if (ontology != null) { var report = new RDFOntologyReasonerReport(); RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Reasoner is going to be applied on Ontology '{0}'", ontology.Value)); //Expand ontology ontology = ontology.UnionWith(RDFBASEOntology.Instance); #region Triggers //Apply first rules this.TriggerRule("EquivalentClassTransitivity", ontology, report); this.TriggerRule("SubClassTransitivity", ontology, report); this.TriggerRule("DisjointWithEntailment", ontology, report); this.TriggerRule("EquivalentPropertyTransitivity", ontology, report); this.TriggerRule("SubPropertyTransitivity", ontology, report); this.TriggerRule("SameAsTransitivity", ontology, report); this.TriggerRule("DifferentFromEntailment", ontology, report); //Apply second rules this.TriggerRule("DomainEntailment", ontology, report); this.TriggerRule("RangeEntailment", ontology, report); this.TriggerRule("ClassTypeEntailment", ontology, report); this.TriggerRule("InverseOfEntailment", ontology, report); this.TriggerRule("SymmetricPropertyEntailment", ontology, report); this.TriggerRule("TransitivePropertyEntailment", ontology, report); this.TriggerRule("PropertyEntailment", ontology, report); this.TriggerRule("SameAsEntailment", ontology, report); #endregion //Unexpand ontology ontology = ontology.DifferenceWith(RDFBASEOntology.Instance); RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Reasoner has been applied on Ontology '{0}'", ontology.Value)); return(report); } throw new RDFSemanticsException("Cannot apply RDFOntologyReasoner because given \"ontology\" parameter is null."); }