I use the spa:set function to aggregate the item_1 and item_2.
Sorry I still don't understand the meaning of spa:set function after reading the manual. Can you please introduce this function?
There are many things to go over here, probably too many for a single reply. First I'd suggest going back over the Stardog documentation in the Machine Learning section and read over it carefully. It's not too long.
I can see how the machine learning implementation can be a bit confusing. I think it might help if you don't think if it so much as a data model where triples are added or removed from a graph but as arguments to a stateful model. I'm not even sure what you'd get if you issued something like the following query. I might have to give it a try and see.
select * where {
graph spa:model {
?s ?p ?o .
}
}
I would also go back and reexamine your data that you're modeling. I'm not quite sure what the data you have represents or what you're trying to predict.