protected ObjectPropertyAxiom(
     IOntology ontology,
     IObjectPropertyExpression objectPropertyExpression
     ) : base(ontology)
 {
     _objectPropertyExpression = objectPropertyExpression;
 }
Esempio n. 2
0
 protected Axiom(
     IOntology ontology
     )
 {
     _ontology = ontology;
     _ontology?.Axioms.Add(this);
 }
Esempio n. 3
0
 protected Entity(
     IOntology ontology,
     string localName
     ) : base(ontology)
 {
     _localName = localName;
 }
Esempio n. 4
0
 public DisjointClasses(
     IOntology ontology,
     params IClassExpression[] classExpressions
     ) : base(ontology)
 {
     _classExpressions = classExpressions;
 }
Esempio n. 5
0
 protected DataPropertyAxiom(
     IOntology ontology,
     IDataPropertyExpression dataPropertyExpression
     ) : base(ontology)
 {
     _dataPropertyExpression = dataPropertyExpression;
 }
Esempio n. 6
0
 public EquivalentClasses(
     IOntology ontology,
     params IClassExpression[] classExpressions
     ) : base(ontology)
 {
     _classExpressions = classExpressions;
 }
Esempio n. 7
0
        public static IDictionary <object, ILookup <IPropertyExpression, ISubClassOf> > Validate(
            this IOntology ontology,
            IDictionary <object, ISet <IClass> > classifications
            )
        {
            var evaluator = new ClassMembershipEvaluator(
                ontology,
                classifications);

            return((
                       from keyValuePair in classifications
                       let individual = keyValuePair.Key
                                        from classExpression in keyValuePair.Value
                                        from subClassOf in ontology.Get <ISubClassOf>()
                                        from annotation in subClassOf.Annotations
                                        where
                                        subClassOf.SubClassExpression == classExpression &&
                                        subClassOf.SuperClassExpression is IPropertyRestriction &&
                                        annotation.Property.Iri == "Validation.Restriction" &&
                                        !subClassOf.SuperClassExpression.Evaluate(
                           evaluator,
                           individual)
                                        group subClassOf by individual into errorsGroupedByIndividual
                                        select errorsGroupedByIndividual
                       ).ToDictionary(
                       group => group.Key,
                       group => group.ToLookup(
                           g => ((IPropertyRestriction)g.SuperClassExpression).PropertyExpression)));
        }
        /// <summary>Adds another built in ontology into this provider instance.</summary>
        /// <param name="ontologies">Ontologiesto be included in this instance.</param>
        /// <returns>This instance of the default ontologies provider.</returns>
        public DefaultOntologiesProvider Include(BuiltInOntologies ontologies)
        {
            foreach (BuiltInOntologies ontology in Enum.GetValues(typeof(BuiltInOntologies)))
            {
                if (((ontologies & ontology) == ontology) && (!_includedOntologies.Contains(ontology)))
                {
                    string resourceName = System.String.Format("{0}.{1}.", typeof(DefaultOntologiesProvider).Namespace, ontology.ToString());
                    resourceName = (from manifestResourceName in GetType().GetTypeInfo().Assembly.GetManifestResourceNames()
                                    where manifestResourceName.StartsWith(resourceName)
                                    select manifestResourceName).FirstOrDefault();
                    if (System.String.IsNullOrEmpty(resourceName))
                    {
                        throw new System.IO.FileNotFoundException(System.String.Format("No embedded ontology stream found for '{0}'.", ontology.ToString()));
                    }

                    IOntology ontologyInstance = _ontologyFactory.Create(
                        GetType().GetTypeInfo().Assembly.GetManifestResourceStream(resourceName),
                        "application/" + (resourceName.EndsWith(".owl") ? "owl" : "rdf") + "+xml");
                    if (ontologyInstance != null)
                    {
                        _includedOntologies.Add(ontology);
                        _ontologies.Add(ontologyInstance);
                    }
                }
            }

            return(this);
        }
Esempio n. 9
0
 public AnnotationProperty(
     IOntology ontology,
     string localName
     ) : base(
         ontology,
         localName)
 {
 }
Esempio n. 10
0
 public Datatype(
     IOntology ontology,
     string localName
     ) : base(
         ontology,
         localName)
 {
 }
Esempio n. 11
0
 public Class(
     IOntology ontology,
     string localName
     ) : base(
         ontology,
         localName)
 {
 }
 public static IObjectPropertyExpression DeclareObjectProperty <T, TProperty>(
     this IOntology ontology,
     string localName,
     Func <T, IEnumerable <TProperty> > property
     ) => new ObjectProperty <T, TProperty>(
     ontology,
     localName,
     property);
 public NamedIndividual(
     IOntology ontology,
     string localName
     ) : base(
         ontology,
         localName)
 {
 }
 public ClassAssertion(
     IOntology ontology,
     IClassExpression classExpression,
     INamedIndividual namedIndividual
     ) : base(ontology)
 {
     _classExpression = classExpression;
     _namedIndividual = namedIndividual;
 }
Esempio n. 15
0
 /// <summary>Creates a new instance of <see cref="OntologyAccessor"/>.</summary>
 internal OntologyAccessor(Entity entity, IOntology ontology, INodeConverter nodeConverter, IResultTransformerCatalog resultTransformers)
 {
     _tripleStore        = entity.Context.Store;
     _entity             = entity;
     _ontology           = ontology;
     _resultTransformers = resultTransformers;
     _nodeConverter      = nodeConverter;
     _context            = entity.Context;
 }
 protected PropertyAssertion(
     IOntology ontology,
     IPropertyExpression propertyExpression,
     INamedIndividual sourceIndividual
     ) : base(ontology)
 {
     _propertyExpression = propertyExpression;
     _sourceIndividual   = sourceIndividual;
 }
Esempio n. 17
0
 public SubClassOf(
     IOntology ontology,
     IClassExpression subClassExpression,
     IClassExpression superClassExpression
     ) : base(ontology)
 {
     _subClassExpression   = subClassExpression;
     _superClassExpression = superClassExpression;
 }
Esempio n. 18
0
 public HasKey(
     IOntology ontology,
     IClassExpression classExpression,
     params IDataPropertyExpression[] dataPropertyExpressions
     ) : base(ontology)
 {
     _classExpression         = classExpression;
     _dataPropertyExpressions = dataPropertyExpressions;
 }
 public ObjectPropertyDomain(
     IOntology ontology,
     IObjectPropertyExpression objectPropertyExpression,
     IClassExpression domain
     ) : base(
         ontology,
         objectPropertyExpression)
 {
     _domain = domain;
 }
Esempio n. 20
0
 public FunctionalObjectProperty(
     IOntology ontology,
     string localName,
     Func <T, TProperty> property
     ) : base(
         ontology,
         localName,
         property)
 {
 }
Esempio n. 21
0
 public DataProperty(
     IOntology ontology,
     string localName,
     Func <T, IEnumerable <TProperty> > property
     ) : base(
         ontology,
         localName,
         property)
 {
 }
 public ObjectPropertyRange(
     IOntology ontology,
     IObjectPropertyExpression objectPropertyExpression,
     IClassExpression range
     ) : base(
         ontology,
         objectPropertyExpression)
 {
     _range = range;
 }
 public DataPropertyDomain(
     IOntology ontology,
     IDataPropertyExpression dataPropertyExpression,
     IClassExpression domain
     ) : base(
         ontology,
         dataPropertyExpression)
 {
     _domain = domain;
 }
Esempio n. 24
0
 protected FunctionalProperty(
     IOntology ontology,
     string localName,
     Func <T, TProperty> property
     ) : base(
         ontology,
         localName)
 {
     _property = property;
 }
Esempio n. 25
0
 public DataPropertyRange(
     IOntology ontology,
     IDataPropertyExpression dataPropertyExpression,
     IDataRange range
     ) : base(
         ontology,
         dataPropertyExpression)
 {
     _range = range;
 }
Esempio n. 26
0
 protected Property(
     IOntology ontology,
     string localName,
     Func <T, IEnumerable <TProperty> > property
     ) : base(
         ontology,
         localName)
 {
     _property = property;
 }
 public DataPropertyAssertion(
     IOntology ontology,
     IDataPropertyExpression dataPropertyExpression,
     INamedIndividual sourceIndividual,
     object targetValue
     ) : base(
         ontology,
         dataPropertyExpression,
         sourceIndividual)
 {
     _dataPropertyExpression = dataPropertyExpression;
     _targetValue            = targetValue;
 }
 public ObjectPropertyAssertion(
     IOntology ontology,
     IObjectPropertyExpression objectPropertyExpression,
     INamedIndividual sourceIndividual,
     object targetIndividual
     ) : base(
         ontology,
         objectPropertyExpression,
         sourceIndividual)
 {
     _objectPropertyExpression = objectPropertyExpression;
     _targetIndividual         = targetIndividual;
 }
Esempio n. 29
0
        /// <summary>Creates an ontology from given stream.</summary>
        /// <param name="fileStream">Stream containing a serialized ontology data.</param>
        /// <param name="contentType">Explicitly passed content type of the data stored in the given stream.</param>
        /// <returns>Ontology beeing an object representation of given data.</returns>
        public IOntology Create(Stream fileStream, string contentType)
        {
            IOntologyLoader ontologyFactory = GetOntologyFactory(contentType);

            if (ontologyFactory == null)
            {
                throw new NotSupportedException(System.String.Format("MIME type of '{0}' is not supported.", contentType));
            }

            IOntology result = ontologyFactory.Create(fileStream);

            fileStream.Dispose();
            return(result);
        }
Esempio n. 30
0
 public static OntologyState Create(IOntology ontology)
 {
     if (ontology == null)
     {
         throw new ArgumentNullException("ontology");
     }
     return(new OntologyState(ontology.Id)
     {
         CanAction = ontology.CanAction,
         CanCommand = ontology.CanCommand,
         CanEvent = ontology.CanEvent,
         Code = ontology.Code,
         CreateOn = ontology.CreateOn,
         DispatcherLoadCount = ontology.DispatcherLoadCount,
         DispatcherSleepTimeSpan = ontology.DispatcherSleepTimeSpan,
         EntityDatabaseId = ontology.EntityDatabaseId,
         EntityProviderId = ontology.EntityProviderId,
         EntitySchemaName = ontology.EntitySchemaName,
         EntityTableName = ontology.EntityTableName,
         ExecutorLoadCount = ontology.ExecutorLoadCount,
         ExecutorSleepTimeSpan = ontology.ExecutorSleepTimeSpan,
         Icon = ontology.Icon,
         IsEnabled = ontology.IsEnabled,
         IsLogicalDeletionEntity = ontology.IsLogicalDeletionEntity,
         IsCataloguedEntity = ontology.IsCataloguedEntity,
         IsSystem = ontology.IsSystem,
         MessageDatabaseId = ontology.MessageDatabaseId,
         MessageProviderId = ontology.MessageProviderId,
         MessageSchemaName = ontology.MessageSchemaName,
         Name = ontology.Name,
         ReceivedMessageBufferSize = ontology.ReceivedMessageBufferSize,
         ServiceIsAlive = ontology.ServiceIsAlive,
         SortCode = ontology.SortCode,
         Triggers = ontology.Triggers
     });
 }