Ah sorry, I was wrong. You call remove on the RDFList object.

According to the implementation, it should modify the current list
object. Have you tried it out? Does it not work?
>> Hello!
>>
>> I have an application, which creates an individual called batch. A batch has 
>> a list of company IDs (strings). Add the property like this:
>>
>>     open fun addCompanyIdsList(
>>             batch: Resource,
>>             companyIds: List<String>,
>>             model: Model) {
>>         val prop = model.createProperty(Bp2BatchCompanyIds)
>>         val list = model.createList()
>>         companyIds
>>                 .filter { it.isNumeric() }
>>                 .map { it.toInt() }
>>                 .map { id -> model.createTypedLiteral(id) }
>>                 .forEach { literal -> list.add(literal) }
>>         batch.addProperty(prop, list)
>>     }
>>
>> In another operation I want to remove the first element of the list so that 
>> this change is saved in Jena. For primitive data types like integers, there 
>> is the method
>>
>> org.apache.jena.rdf.model.Statement#changeLiteralObject(boolean)
>>
>> and its analogs.
>>
>> How do I change the list? Is it sufficient to just remove an element from 
>> the list like in the code snippet below?
>>              
>>      ds.begin(ReadWrite.WRITE)
>>      val query = createQuery("""SELECT ?x
>>                                              WHERE { ?x  $Bp2BatchNumber  
>> $batchId }""")
>>      val qexec = createQueryExecution(ds, query)
>>      val rs = qexec.execSelect()
>>      val sol = rs.nextSolution()
>>      val rec = sol["x"]
>>      val prop = findStatement(Bp2BatchCompanyIds, rec as Resource)
>>      val companyIds = prop.`object` as RDFList
>>      val head = companyIds.head
>>      companyIds.remove(result)
>>      ds.end()
> Which programming language is this?
> Does your code compile? I'm asking because there is just a getHead()
> method on an RDFList object. And this one returns an RDFNode object,
> thus, remove should be impossible here.
>> Thanks in advance
>>
>> Dmitri Pisarenko
>>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

Reply via email to