/// <summary> /// Removes the "ontologyFact -> datatypeProperty -> ontologyLiteral" relation from the data /// </summary> public RDFOntologyData RemoveAssertionRelation(RDFOntologyFact ontologyFact, RDFOntologyDatatypeProperty datatypeProperty, RDFOntologyLiteral ontologyLiteral) { if (ontologyFact != null && datatypeProperty != null && ontologyLiteral != null) { this.Relations.Assertions.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, datatypeProperty, ontologyLiteral)); } return(this); }
/// <summary> /// Removes the given literal from the data /// </summary> public RDFOntologyData RemoveLiteral(RDFOntologyLiteral ontologyLiteral) { if (ontologyLiteral != null) { if (this.Literals.ContainsKey(ontologyLiteral.PatternMemberID)) { this.Literals.Remove(ontologyLiteral.PatternMemberID); } } return(this); }
/// <summary> /// Adds the given literal to the data /// </summary> public RDFOntologyData AddLiteral(RDFOntologyLiteral ontologyLiteral) { if (ontologyLiteral != null) { if (!this.Literals.ContainsKey(ontologyLiteral.PatternMemberID)) { this.Literals.Add(ontologyLiteral.PatternMemberID, ontologyLiteral); } } return(this); }
/// <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); }
/// <summary> /// Default-ctor to build an "owl:HasValue" ontology restriction with the given name on the given property and the given required value /// </summary> public RDFOntologyHasValueRestriction(RDFResource restrictionName, RDFOntologyProperty onProperty, RDFOntologyLiteral requiredValue) : base(restrictionName, onProperty) { if (requiredValue != null) { this.RequiredValue = requiredValue; } else { throw new RDFSemanticsException("Cannot create RDFOntologyHasValueRestriction because given \"requiredValue\" parameter is null."); } }