/// <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.");
     }
 }
Example #2
0
 /// <summary>
 /// Default-ctor to build an "owl:AllValuesFrom" ontology restriction with the given name on the given property and the given fromClass
 /// </summary>
 public RDFOntologyAllValuesFromRestriction(RDFResource restrictionName,
                                            RDFOntologyProperty onProperty,
                                            RDFOntologyClass fromClass) : base(restrictionName, onProperty)
 {
     if (fromClass != null)
     {
         this.FromClass = fromClass;
     }
     else
     {
         throw new RDFSemanticsException("Cannot create RDFOntologyAllValuesFromRestriction because given \"fromClass\" parameter is null.");
     }
 }
Example #3
0
        /// <summary>
        /// Default-ctor to build an ontology cardinality restriction with the given name on the given property
        /// </summary>
        public RDFOntologyCardinalityRestriction(RDFResource restrictionName,
                                                 RDFOntologyProperty onProperty,
                                                 int minCardinality,
                                                 int maxCardinality) : base(restrictionName, onProperty)
        {
            //MinCardinality
            if (minCardinality > 0)
            {
                if (maxCardinality > 0)
                {
                    if (minCardinality <= maxCardinality)
                    {
                        this.MinCardinality = minCardinality;
                    }
                    else
                    {
                        throw new RDFSemanticsException("Cannot create RDFOntologyCardinalityRestriction because given \"minCardinality\" parameter (" + minCardinality + ") must be less or equal than given \"maxCardinality\" parameter (" + maxCardinality + ")");
                    }
                }
                else
                {
                    this.MinCardinality = minCardinality;
                }
            }

            //MaxCardinality
            if (maxCardinality > 0)
            {
                if (minCardinality > 0)
                {
                    if (maxCardinality >= minCardinality)
                    {
                        this.MaxCardinality = maxCardinality;
                    }
                    else
                    {
                        throw new RDFSemanticsException("Cannot create RDFOntologyCardinalityRestriction because given \"maxCardinality\" parameter (" + maxCardinality + ") must be greater or equal than given \"minCardinality\" parameter (" + minCardinality + ")");
                    }
                }
                else
                {
                    this.MaxCardinality = maxCardinality;
                }
            }

            if (this.MinCardinality == 0 && this.MaxCardinality == 0)
            {
                throw new RDFSemanticsException("Cannot create RDFOntologyCardinalityRestriction because at least one of the given \"minCardinality\" and \"maxCardinality\" parameters must be greater than 0.");
            }
        }
Example #4
0
 /// <summary>
 /// Builds a property model lens for the given property on the given ontology
 /// </summary>
 public RDFOntologyPropertyModelLens(RDFOntologyProperty ontologyProperty, RDFOntology ontology)
 {
     if (ontologyProperty != null)
     {
         if (ontology != null)
         {
             this.OntologyProperty = ontologyProperty;
             this.Ontology         = ontology.UnionWith(RDFBASEOntology.Instance);
         }
         else
         {
             throw new RDFSemanticsException("Cannot create property model lens because given \"ontology\" parameter is null");
         }
     }
     else
     {
         throw new RDFSemanticsException("Cannot create property model lens because given \"ontologyProperty\" parameter is null");
     }
 }
 /// <summary>
 /// Default-ctor to build an ontology restriction with the given name on the given ontology property
 /// </summary>
 internal RDFOntologyRestriction(RDFResource restrictionName,
                                 RDFOntologyProperty onProperty) : base(restrictionName)
 {
     if (onProperty != null)
     {
         //Annotation properties cannot be restricted (OWL-DL)
         if (!onProperty.IsAnnotationProperty())
         {
             this.OnProperty = onProperty;
         }
         else
         {
             throw new RDFSemanticsException("Cannot create RDFOntologyRestriction because given \"onProperty\" parameter is an annotation property (this is forbidden in OWL-DL).");
         }
     }
     else
     {
         throw new RDFSemanticsException("Cannot create RDFOntologyRestriction because given \"onProperty\" parameter is null.");
     }
 }
Example #6
0
 /// <summary>
 /// Checks if the given property is a reserved BASE ontology property
 /// </summary>
 internal static Boolean CheckReservedProperty(RDFOntologyProperty ontProperty)
 {
     return(RDFBASEOntology.Instance.Model.PropertyModel.Properties.ContainsKey(ontProperty.PatternMemberID));
 }
Example #7
0
 /// <summary>
 /// Default-ctor to build an "owl:HasSelf" ontology restriction with the given name on the given property
 /// </summary>
 public RDFOntologyHasSelfRestriction(RDFResource restrictionName, RDFOntologyProperty onProperty) : base(restrictionName, onProperty)
 {
 }