Esempio n. 1
0
        private OlsplPattern GetPatternByLabelOfProperty(OwlObjectProperty property, INode label)
        {
            var domain          = property.Domain;
            var range           = property.Range;
            var domainLocalName = domain.GetLocalName();
            var rangeLocalName  = range.GetLocalName();

            var rule    = $"{domainLocalName} {label} {rangeLocalName}";
            var entity1 = new RdfEntity
            {
                //Type = domain.ToString(),
                TypeTerm    = domainLocalName,
                Label       = Var1,
                EntityIndex = 1,
            };

            var entity2 = new RdfEntity
            {
                //Type = range.ToString(),
                TypeTerm    = rangeLocalName,
                Label       = Var2,
                EntityIndex = 2,
            };

            var totalTriplet = new Triplet(domain, property, range, 1, 2);

            return(new OlsplPattern
            {
                Rule = rule,
                Entity1 = entity1,
                Entity2 = entity2,
                TotalTriplet = totalTriplet,
                Comment = "Generated via domain and ranges",
            });
        }
Esempio n. 2
0
        private List <OlsplPattern> GetOlsplPatternsViaClassLabels(List <OwlClass> classes)
        {
            var patterns = new List <OlsplPattern>();

            foreach (var owlClass in classes)
            {
                foreach (var label in owlClass.Labels)
                {
                    var classUri       = owlClass.ObjectClassURI;
                    var classLocalName = classUri.GetLocalName();
                    var rule1          = $"{classLocalName} - {label}";

                    var entity = new RdfEntity
                    {
                        //Type = classUri.ToString(),
                        TypeTerm    = classLocalName,
                        Label       = Var1,
                        EntityIndex = 1,
                    };

                    var comment = "Generated via class labels";

                    var pattern = new OlsplPattern
                    {
                        Rule    = rule1,
                        Entity1 = entity,
                        Comment = comment,
                    };

                    patterns.Add(pattern);
                }
            }

            return(patterns);
        }
Esempio n. 3
0
        private OlsplPattern GetPatternByLabelOfRestriction(Restriction restriction, INode label)
        {
            var parentClass          = restriction.ParentClassUri;
            var onClass              = restriction.OwlOnClass;
            var parentClassLocalName = parentClass.GetLocalName();
            var onClassLocalName     = onClass.GetLocalName();

            var rule = $"{parentClassLocalName} {label} {onClassLocalName}";

            var entity1 = new RdfEntity
            {
                //Type = parentClass.ToString(),
                TypeTerm    = parentClassLocalName,
                Label       = Var1,
                EntityIndex = 1,
            };

            var entity2 = new RdfEntity
            {
                //Type = onClass.ToString(),
                TypeTerm    = onClassLocalName,
                Label       = Var2,
                EntityIndex = 2,
            };

            var totalTriplet = new Triplet(parentClass, restriction, onClass, 1, 2);

            string comment = null;

            if (restriction.Cardinality == null)
            {
                comment = $"Generated via restriction - {restriction.RestrictionType}: {onClass}";
            }
            else
            {
                comment = $"Generated via restriction - {restriction.RestrictionType}: {restriction.Cardinality} for {onClass}";
            }


            return(new OlsplPattern
            {
                Rule = rule,
                Entity1 = entity1,
                Entity2 = entity2,
                TotalTriplet = totalTriplet,
                Comment = comment,
            });
        }
Esempio n. 4
0
 private List <RdfEntity> GetEntityWithSameTypeAndLabel(RdfEntity entity, IEnumerable <RdfEntity> entities)
 {
     return(entities.Where(x => x.TypeTerm == entity.TypeTerm && x.Label == entity.Label).ToList());
 }