internal static IRestriction CreateRestriction(this IResource resource, Uri onProperty, IEntity allValuesFrom) { var typeConstrain = resource.Context.Create <IRestriction>(resource.CreateBlankId()); typeConstrain.OnProperty = resource.Context.Create <IProperty>(new EntityId(onProperty)); typeConstrain.AllValuesFrom = allValuesFrom; return(typeConstrain); }
internal static IRestriction CreateRestriction(this IResource resource, IProperty onProperty, uint maxCardinality) { var typeConstrain = resource.Context.Create <IRestriction>(resource.CreateBlankId()); typeConstrain.OnProperty = onProperty; typeConstrain.MaxCardinality = maxCardinality; return(typeConstrain); }
internal static bool IsGenericRdfList(this IClass @class, out IResource itemRestriction) { bool result = false; itemRestriction = null; foreach (var superClass in @class.SubClassOf) { if (superClass.IsClass(Rdf.List)) { result = true; } IRestriction restriction; if ((superClass.Is(RomanticWeb.Vocabularies.Owl.Restriction)) && ((restriction = superClass.AsEntity <IRestriction>()).OnProperty != null) && (restriction.OnProperty.Id == Rdf.first) && (restriction.AllValuesFrom != null) && (restriction.AllValuesFrom.Is(RomanticWeb.Vocabularies.Rdfs.Resource))) { itemRestriction = restriction.AllValuesFrom.AsEntity <IResource>(); } } return(result); }