/// <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> /// Enlists the facts which are members of the given non literal-compatible class within the given ontology /// (internal-only method for performance purposes, used during validation and reasoning logics) /// </summary> internal static RDFOntologyData EnlistMembersOfNonLiteralCompatibleClass(RDFOntologyClass ontClass, RDFOntology ontology) { var result = new RDFOntologyData(); if (ontClass != null && ontology != null) { //Restriction if (ontClass.IsRestrictionClass()) { result = RDFSemanticsUtilities.EnlistMembersOfRestriction((RDFOntologyRestriction)ontClass, ontology); } //Composite else if (ontClass.IsCompositeClass()) { result = RDFSemanticsUtilities.EnlistMembersOfComposite(ontClass, ontology); } //Enumerate else if (ontClass.IsEnumerateClass()) { result = RDFSemanticsUtilities.EnlistMembersOfEnumerate((RDFOntologyEnumerateClass)ontClass, ontology); } //Class else { result = RDFSemanticsUtilities.EnlistMembersOfClass(ontClass, ontology); } } return(result); }
/// <summary> /// Enlists the given "aFact -> transOntProp" assertions within the given data /// </summary> public static RDFOntologyData EnlistTransitiveAssertionsOf(RDFOntologyFact ontFact, RDFOntologyObjectProperty transOntProp, RDFOntologyData data) { var result = new RDFOntologyData(); if (ontFact != null && transOntProp != null && transOntProp.IsTransitiveProperty() && data != null) { result = RDFSemanticsUtilities.EnlistTransitiveAssertionsOf_Core(ontFact, transOntProp, data, null); } return(result); }
/// <summary> /// Enlists the different facts of the given fact within the given data /// </summary> public static RDFOntologyData EnlistDifferentFactsFrom(RDFOntologyFact ontFact, RDFOntologyData data) { var result = new RDFOntologyData(); if (ontFact != null && data != null) { result = RDFSemanticsUtilities.EnlistDifferentFactsFrom_Core(ontFact, data, null) .RemoveFact(ontFact); //Safety deletion } return(result); }
/// <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 disjointClasses with the given class within the given class model /// </summary> public static RDFOntologyClassModel EnlistDisjointClassesWith(RDFOntologyClass ontClass, RDFOntologyClassModel classModel) { var result = new RDFOntologyClassModel(); if (ontClass != null && classModel != null) { result = RDFSemanticsUtilities.EnlistDisjointClassesWith_Core(ontClass, classModel, null) .RemoveClass(ontClass); //Safety deletion } return(result); }
/// <summary> /// Enlists the superClasses of the given class within the given class model /// </summary> public static RDFOntologyClassModel EnlistSuperClassesOf(RDFOntologyClass ontClass, RDFOntologyClassModel classModel) { var result = new RDFOntologyClassModel(); if (ontClass != null && classModel != null) { //Step 1: Reason on the given class result = RDFSemanticsUtilities.EnlistSuperClassesOf_Core(ontClass, classModel); //Step 2: Reason on the equivalent classes foreach (var ec in EnlistEquivalentClassesOf(ontClass, classModel)) { result = result.UnionWith(RDFSemanticsUtilities.EnlistSuperClassesOf_Core(ec, classModel)); } } 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> /// Gets a graph representation of this ontology, exporting inferences according to the selected behavior /// </summary> public RDFGraph ToRDFGraph(RDFSemanticsEnums.RDFOntologyInferenceExportBehavior infexpBehavior) { return(RDFSemanticsUtilities.ToRDFGraph(this, infexpBehavior)); }
/// <summary> /// Gets an ontology representation of the given graph. /// </summary> public static RDFOntology FromRDFGraph(RDFGraph ontGraph) { return(RDFSemanticsUtilities.FromRDFGraph(ontGraph)); }