0

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.
    }
} 
ib.
  • 27,830
  • 11
  • 80
  • 100
ilmav
  • 13
  • 4
  • I'm not too familiar with GraphDB, but perhaps you should put the last line outside of the SERVICE query. INSERT { ?disease a :Disease ; stbio:class ?Disease_Class. } WHERE { ?disease stbio:name ?Disease_Name. SERVICE { ?row a :Row ; :Disease_Name ?Disease_Name ; :Disease_Class ?Disease_Class. } } – Valerio Cocchi Aug 14 '20 at 15:38
  • may I ask what does not work with the query? – UninformedUser Aug 14 '20 at 19:31
  • i needed to put the last line out of the SERVICE query as @ValerioCocchi said. Thank you both – ilmav Aug 15 '20 at 11:36

1 Answers1

0

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).

Vladimir Alexiev
  • 2,477
  • 1
  • 20
  • 31