Ejemplo n.º 1
0
        public static void SetProperty(this OntologyResource resource, string propertyName, INode value)
        {
            resource.RemoveProperty(propertyName);
            OntologyProperty property = ((OntologyGraph)resource.Graph).OwlProperties.FirstOrDefault(s => s.Resource.ToString().EndsWith(propertyName));

            if (value != null && property != null)
            {
                Triple triple = new Triple(resource.Resource, property.Resource, value, resource.Graph);
                resource.Graph.Assert(triple);
            }
        }
Ejemplo n.º 2
0
        public static void SetProperties(this OntologyResource resource, string propertyName, List <INode> values)
        {
            resource.RemoveProperty(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(resource.Resource, property.Resource, v, resource.Graph));
                resource.Graph.Assert(triples);
            }
        }