How to set and update properties on existing nodes via CSV file using SPARQL on GraphDB

90 Views Asked by At

I would like to set a new property to existing nodes whose type is :Disease. The CSV file has two columns. The first has the header Disease_Name and the second one has the header Disease_Class. I want to match the nodes (subject ?disease) for which the property :name has the same value as the value of the cells in the Disease_Name column, and create a new property (:class) with the same value as the one of the cell (in the same row) in the Disease_Class column.

INSERT {
    ?disease a :Disease ;
        stbio:class ?Disease_Class.
        
} WHERE {
    SERVICE <ontorefine:2512803899077> {
        ?row a :Row ;
            :Disease_Name ?Disease_Name ;
            :Disease_Class ?Disease_Class.
        ?disease stbio:name ?Disease_Name.
    }
} 
1

There are 1 best solutions below

0
Vladimir Alexiev On

If stbio:class is a class, maybe you also need to do some manipulation of ?Disease_Class which would be a string?

Answered (so it doesn't appear in [graphdb] answers:0 again).