Without seeing all of your code and what some of the values are, we can't be sure what's happening, but I think the problem here is that you can't use RDFList#add with an empty list, and I think that's what you're creating at the start. Since you're creating a list with no elements, you should be getting rdf:nil back, which is the empty list. Note that the documentation for RDFList#add says:
If this list is the empty (nil) list, we cannot perform a side-effecting update without changing the URI of this node (from rdf:nil) to a blank-node for the new list cell) without violating a Jena invariant. Therefore, this update operation will throw an exception if an attempt is made to add to the nil list. Safe ways to add to an empty list include with(RDFNode) and cons(RDFNode).
You didn't mention whether you're getting that exception or not.
In your case, I think the easiest thing to do would be to create the array of OntClasses, and then just create the list from them. That is, you could do something like (untested):
String[] parts = list.split("-");
RDFNode[] elements = new RDFNode[parts.length];
for(int i = 0; i<parts.length; i++){
elements[i] = model.getOntClass("http://example.org/"+parts[i]);
}
RDFList list = model.createList(elements);
Alternatively, if you want to use with, as mentioned in the documentation, you'd do something like (again, untested):
RDFList list = model.createList(new RDFNode[] {});
//string with names of rdf classes
String[] parts = list.split("-");
for(int i = 0; i<parts.length; i++){
OntClass oclass = model.getOntClass("http://example.org/"+parts[i]);
list = list.with(oclass);
}
For a bit more about this, you might find this answer of mine and the comments on it relevant. You're not the first one to have had a bit of a struggle with RDFLists.