/// <summary>
        /// Builds a new difference taxonomy from this taxonomy and a given one
        /// </summary>
        internal RDFOntologyTaxonomy DifferenceWith(RDFOntologyTaxonomy taxonomy)
        {
            var result = new RDFOntologyTaxonomy(this.Category);

            if (taxonomy != null)
            {
                //Add difference entries
                foreach (var te in this)
                {
                    if (!taxonomy.ContainsEntry(te))
                    {
                        result.AddEntry(te);
                    }
                }
            }
            else
            {
                //Add entries from this taxonomy
                foreach (var te in this)
                {
                    result.AddEntry(te);
                }
            }
            return(result);
        }
        /// <summary>
        /// Enlists the negative data assertions which are directly (or indirectly, if inference is requested) assigned to the lens fact
        /// </summary>
        public List <(bool, RDFOntologyDatatypeProperty, RDFOntologyLiteral)> NegativeDataAssertions(bool enableInference)
        {
            List <(bool, RDFOntologyDatatypeProperty, RDFOntologyLiteral)> result = new List <(bool, RDFOntologyDatatypeProperty, RDFOntologyLiteral)>();

            RDFOntologyTaxonomy sftaxonomy = this.Ontology.Data.Relations.NegativeAssertions.SelectEntriesBySubject(this.OntologyFact);

            if (enableInference)
            {
                //Inference-enabled discovery of assigned literal negative relations
                foreach (RDFOntologyTaxonomyEntry sf in sftaxonomy.Where(te => te.TaxonomyPredicate.IsDatatypeProperty()))
                {
                    result.Add((sf.IsInference(), (RDFOntologyDatatypeProperty)sf.TaxonomyPredicate, (RDFOntologyLiteral)sf.TaxonomyObject));
                }
            }
            else
            {
                //First-level enlisting of assigned literal negative relations
                foreach (RDFOntologyTaxonomyEntry sf in sftaxonomy.Where(te => te.TaxonomyPredicate.IsDatatypeProperty() && !te.IsInference()))
                {
                    result.Add((false, (RDFOntologyDatatypeProperty)sf.TaxonomyPredicate, (RDFOntologyLiteral)sf.TaxonomyObject));
                }
            }

            return(result);
        }
 /// <summary>
 /// Default-ctor to build an empty ontology class model metadata
 /// </summary>
 internal RDFOntologyClassModelMetadata()
 {
     this.SubClassOf      = new RDFOntologyTaxonomy(RDFSemanticsEnums.RDFOntologyTaxonomyCategory.Model, false);
     this.EquivalentClass = new RDFOntologyTaxonomy(RDFSemanticsEnums.RDFOntologyTaxonomyCategory.Model, false);
     this.DisjointWith    = new RDFOntologyTaxonomy(RDFSemanticsEnums.RDFOntologyTaxonomyCategory.Model, false);
     this.OneOf           = new RDFOntologyTaxonomy(RDFSemanticsEnums.RDFOntologyTaxonomyCategory.Model, false);
     this.IntersectionOf  = new RDFOntologyTaxonomy(RDFSemanticsEnums.RDFOntologyTaxonomyCategory.Model, false);
     this.UnionOf         = new RDFOntologyTaxonomy(RDFSemanticsEnums.RDFOntologyTaxonomyCategory.Model, false);
     this.HasKey          = new RDFOntologyTaxonomy(RDFSemanticsEnums.RDFOntologyTaxonomyCategory.Model, false);
 }
        /// <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);

            if (objectResource != null)
            {
                foreach (var te   in this.Where(tEntry => tEntry.TaxonomyObject.Equals(objectResource)))
                {
                    resultTaxonomy.AddEntry(te);
                }
            }
            return(resultTaxonomy);
        }
Exemple #5
0
        /// <summary>
        /// Gets a taxonomy with the entries having the specified ontology resource as predicate
        /// </summary>
        public RDFOntologyTaxonomy SelectEntriesByPredicate(RDFOntologyResource predicateResource)
        {
            var resultTaxonomy = new RDFOntologyTaxonomy(this.Category, this.AcceptDuplicates);

            if (predicateResource != null)
            {
                foreach (var te in this.Where(tEntry => tEntry.TaxonomyPredicate.Equals(predicateResource)))
                {
                    resultTaxonomy.AddEntry(te);
                }
            }
            return(resultTaxonomy);
        }
        /// <summary>
        /// Builds a new intersection taxonomy from this taxonomy and a given one
        /// </summary>
        internal RDFOntologyTaxonomy IntersectWith(RDFOntologyTaxonomy taxonomy)
        {
            var result = new RDFOntologyTaxonomy(this.Category);

            if (taxonomy != null)
            {
                //Add intersection triples
                foreach (var te in this)
                {
                    if (taxonomy.ContainsEntry(te))
                    {
                        result.AddEntry(te);
                    }
                }
            }
            return(result);
        }
Exemple #7
0
        /// <summary>
        /// Builds a new intersection taxonomy from this taxonomy and a given one
        /// </summary>
        internal RDFOntologyTaxonomy IntersectWith(RDFOntologyTaxonomy taxonomy)
        {
            RDFOntologyTaxonomy result = new RDFOntologyTaxonomy(this.Category, this.AcceptDuplicates);

            if (taxonomy != null)
            {
                //Add intersection triples
                foreach (RDFOntologyTaxonomyEntry te in this)
                {
                    if (taxonomy.ContainsEntry(te))
                    {
                        result.AddEntry(te);
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// Builds a new union taxonomy from this taxonomy and a given one
        /// </summary>
        internal RDFOntologyTaxonomy UnionWith(RDFOntologyTaxonomy taxonomy)
        {
            var result = new RDFOntologyTaxonomy(this.Category);

            //Add entries from this taxonomy
            foreach (var te in this)
            {
                result.AddEntry(te);
            }

            //Manage the given taxonomy
            if (taxonomy != null)
            {
                //Add entries from the given taxonomy
                foreach (var te in taxonomy)
                {
                    result.AddEntry(te);
                }
            }
            return(result);
        }