Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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);
        }
Example #4
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);
        }
Example #5
0
        /// <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);
        }
Example #6
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);
        }