| 150 | | assert(librdf_node_is_literal(symbol_node)); |
| 151 | | assert(librdf_node_is_literal(index_node)); |
| 152 | | |
| 153 | | const char* symbol = (const char*)librdf_node_get_literal_value(symbol_node); |
| 154 | | const char* index = (const char*)librdf_node_get_literal_value(index_node); |
| 155 | | |
| 156 | | const int this_index = atoi(index); |
| 157 | | SLV2Port this_port = NULL; |
| 158 | | |
| 159 | | // ORDER BY guarantees order |
| 160 | | assert(this_index <= num_ports); |
| 161 | | |
| 162 | | // Create a new SLV2Port, and add to template |
| 163 | | if (this_index == num_ports) { |
| 164 | | assert(this_index == last_index + 1); |
| 165 | | this_port = slv2_port_new(p->world, (unsigned)atoi(index), symbol); |
| 166 | | raptor_sequence_push(p->ports, this_port); |
| 167 | | ++num_ports; |
| 168 | | ++last_index; |
| 169 | | |
| 170 | | // More information about a port we already created |
| 171 | | } else if (this_index < num_ports) { |
| 172 | | this_port = slv2_plugin_get_port_by_index(p, this_index); |
| 173 | | } |
| 174 | | |
| 175 | | if (this_port) { |
| | 146 | if (librdf_node_is_literal(symbol_node) &&librdf_node_is_literal(index_node)) { |
| | 147 | const char* symbol = (const char*)librdf_node_get_literal_value(symbol_node); |
| | 148 | const char* index = (const char*)librdf_node_get_literal_value(index_node); |
| | 149 | |
| | 150 | const int this_index = atoi(index); |
| | 151 | SLV2Port this_port = raptor_sequence_get_at(p->ports, this_index); |
| | 152 | |
| | 153 | // Havn't seen this port yet, add it to sequence |
| | 154 | if (!this_port) { |
| | 155 | this_port = slv2_port_new(p->world, this_index, symbol); |
| | 156 | raptor_sequence_set_at(p->ports, this_index, this_port); |
| | 157 | } |
| | 158 | |