Ejemplo n.º 1
0
        public static void SetSubjectsByObjectProperty(this OntologyResource resource, string propertyName, List <UriNode> values)
        {
            resource.RemovePropertyByObject(propertyName);
            OntologyProperty property = ((OntologyGraph)resource.Graph).OwlProperties.FirstOrDefault(s => s.Resource.ToString().EndsWith(propertyName));

            if (values != null && values.Any() && property != null)
            {
                IEnumerable <Triple> triples = values.Select(v => new Triple(v, property.Resource, resource.Resource, resource.Graph));
                resource.Graph.Assert(triples);
            }
        }