/// <summary> /// Gets a taxonomy with the entries having the specified ontology resource as object /// </summary> public RDFOntologyTaxonomy SelectEntriesByObject(RDFOntologyResource objectResource) { var resultTaxonomy = new RDFOntologyTaxonomy(this.Category, this.AcceptDuplicates); if (objectResource != null) { foreach (var te in this.Where(tEntry => tEntry.TaxonomyObject.Equals(objectResource))) { resultTaxonomy.AddEntry(te); } } return(resultTaxonomy); }
/// <summary> /// Gets the evidences having the given content object /// </summary> public List <RDFOntologyReasonerEvidence> SelectEvidencesByContentObject(RDFOntologyResource evidenceContentObject) => this.Evidences.Values.Where(e => e.EvidenceContent.TaxonomyObject.Equals(evidenceContentObject)).ToList();
/// <summary> /// Gets the evidences having the given content predicate /// </summary> public List <RDFOntologyReasonerEvidence> SelectEvidencesByContentPredicate(RDFOntologyResource evidenceContentPredicate) => this.Evidences.Values.Where(e => e.EvidenceContent.TaxonomyPredicate.Equals(evidenceContentPredicate)).ToList();
/// <summary> /// Removes the given custom annotation from the given ontology fact /// </summary> public RDFOntologyData RemoveCustomAnnotation(RDFOntologyAnnotationProperty ontologyAnnotationProperty, RDFOntologyFact ontologyFact, RDFOntologyResource annotationValue) { if (ontologyAnnotationProperty != null && ontologyFact != null && annotationValue != null) { //owl:versionInfo if (ontologyAnnotationProperty.Equals(RDFVocabulary.OWL.VERSION_INFO.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionInfo, ontologyFact, annotationValue); } //owl:versionIRI else if (ontologyAnnotationProperty.Equals(RDFVocabulary.OWL.VERSION_IRI.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionIRI, ontologyFact, annotationValue); } //rdfs:comment else if (ontologyAnnotationProperty.Equals(RDFVocabulary.RDFS.COMMENT.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.Comment, ontologyFact, annotationValue); } //rdfs:label else if (ontologyAnnotationProperty.Equals(RDFVocabulary.RDFS.LABEL.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.Label, ontologyFact, annotationValue); } //rdfs:seeAlso else if (ontologyAnnotationProperty.Equals(RDFVocabulary.RDFS.SEE_ALSO.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.SeeAlso, ontologyFact, annotationValue); } //rdfs:isDefinedBy else if (ontologyAnnotationProperty.Equals(RDFVocabulary.RDFS.IS_DEFINED_BY.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.IsDefinedBy, ontologyFact, annotationValue); } //owl:imports else if (ontologyAnnotationProperty.Equals(RDFVocabulary.OWL.IMPORTS.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.Imports, ontologyFact, annotationValue); } //owl:backwardCompatibleWith else if (ontologyAnnotationProperty.Equals(RDFVocabulary.OWL.BACKWARD_COMPATIBLE_WITH.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.BackwardCompatibleWith, ontologyFact, annotationValue); } //owl:incompatibleWith else if (ontologyAnnotationProperty.Equals(RDFVocabulary.OWL.INCOMPATIBLE_WITH.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.IncompatibleWith, ontologyFact, annotationValue); } //owl:priorVersion else if (ontologyAnnotationProperty.Equals(RDFVocabulary.OWL.PRIOR_VERSION.ToRDFOntologyAnnotationProperty())) { this.RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation.PriorVersion, ontologyFact, annotationValue); } //custom annotation else { this.Annotations.CustomAnnotations.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, ontologyAnnotationProperty, annotationValue)); } } return(this); }
/// <summary> /// Removes the given standard annotation from the given ontology fact /// </summary> public RDFOntologyData RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation standardAnnotation, RDFOntologyFact ontologyFact, RDFOntologyResource annotationValue) { if (ontologyFact != null && annotationValue != null) { switch (standardAnnotation) { //owl:versionInfo case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionInfo: this.Annotations.VersionInfo.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.VERSION_INFO.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //owl:versionIRI case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionIRI: this.Annotations.VersionIRI.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.VERSION_IRI.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //rdfs:comment case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Comment: this.Annotations.Comment.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.COMMENT.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //rdfs:label case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Label: this.Annotations.Label.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.LABEL.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //rdfs:seeAlso case RDFSemanticsEnums.RDFOntologyStandardAnnotation.SeeAlso: this.Annotations.SeeAlso.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.SEE_ALSO.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //rdfs:isDefinedBy case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IsDefinedBy: this.Annotations.IsDefinedBy.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.IS_DEFINED_BY.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //owl:priorVersion case RDFSemanticsEnums.RDFOntologyStandardAnnotation.PriorVersion: this.Annotations.PriorVersion.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.PRIOR_VERSION.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //owl:imports case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Imports: this.Annotations.Imports.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.IMPORTS.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //owl:backwardCompatibleWith case RDFSemanticsEnums.RDFOntologyStandardAnnotation.BackwardCompatibleWith: this.Annotations.BackwardCompatibleWith.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.BACKWARD_COMPATIBLE_WITH.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //owl:incompatibleWith case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IncompatibleWith: this.Annotations.IncompatibleWith.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.INCOMPATIBLE_WITH.ToRDFOntologyAnnotationProperty(), annotationValue)); break; } } return(this); }
/// <summary> /// Adds the given standard annotation to the given ontology fact /// </summary> public RDFOntologyData AddStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation standardAnnotation, RDFOntologyFact ontologyFact, RDFOntologyResource annotationValue) { if (ontologyFact != null && annotationValue != null) { switch (standardAnnotation) { //owl:versionInfo case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionInfo: if (annotationValue.IsLiteral()) { this.Annotations.VersionInfo.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.VERSION_INFO.ToRDFOntologyAnnotationProperty(), annotationValue)); } else { RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Cannot annotate ontology fact with owl:versionInfo value '{0}' because it is not an ontology literal", annotationValue)); } break; //owl:versionIRI case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionIRI: RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:versionIRI because it is reserved for ontologies"); break; //rdfs:comment case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Comment: if (annotationValue.IsLiteral()) { this.Annotations.Comment.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.COMMENT.ToRDFOntologyAnnotationProperty(), annotationValue)); } else { RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Cannot annotate ontology fact with rdfs:comment value '{0}' because it is not an ontology literal", annotationValue)); } break; //rdfs:label case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Label: if (annotationValue.IsLiteral()) { this.Annotations.Label.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.LABEL.ToRDFOntologyAnnotationProperty(), annotationValue)); } else { RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Cannot annotate ontology fact with rdfs:label value '{0}' because it is not an ontology literal", annotationValue)); } break; //rdfs:seeAlso case RDFSemanticsEnums.RDFOntologyStandardAnnotation.SeeAlso: this.Annotations.SeeAlso.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.SEE_ALSO.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //rdfs:isDefinedBy case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IsDefinedBy: this.Annotations.IsDefinedBy.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.IS_DEFINED_BY.ToRDFOntologyAnnotationProperty(), annotationValue)); break; //owl:priorVersion case RDFSemanticsEnums.RDFOntologyStandardAnnotation.PriorVersion: RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:priorVersion because it is reserved for ontologies"); break; //owl:imports case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Imports: RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:imports because it is reserved for ontologies"); break; //owl:backwardCompatibleWith case RDFSemanticsEnums.RDFOntologyStandardAnnotation.BackwardCompatibleWith: RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:backwardCompatibleWith because it is reserved for ontologies"); break; //owl:incompatibleWith case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IncompatibleWith: RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:incompatibleWith because it is reserved for ontologies"); break; } } return(this); }