Aparna Bhat
Aparna Bhat

Reputation: 41

Owlready2: How to add a list of values containing duplicates to object property?

I have modeled the ontology in Protege. And populating this ontology from csv data. It executes fine if I have individual values or a list of values without duplicates. But the actual list has duplicate values. What would be the solution to append all the values to an objectproperty?

listofitemswithduplicate = [0,1,2,3,2,4,9,0,1]
 for item in listofitemswithduplicate:
      classObject.hasProperty.append(item)

I tried to make the object property functional and assign the list directly. Unfortunately, it did not work.

I want hasProperty to hold the values [0,1,2,3,2,4,9,0,1] and not [0,1,2,3,5,9].

Upvotes: 0

Views: 75

Answers (0)

Related Questions