I am working with JENA framework to scrape info about public contracts and publish it as RDF and I can't get over following problem:
When creating new RDF model, I create new Resource for each contract and then assign bunch of properties (that I scraped) using JENA's addProperty(Property, RDFNode) or addProperty(Property, String) method. The problem is, that some contracts are missing some properties so I get NullPointerException.
Using
if(contract.getProperty() != null)
{
   resource.addProperty(VOCABULARY.property, contract.getProperty());
}
for every single property is probably not the best way and since the second parameter of addProperty() method differs a lot
(it can be directly the contract.getProperty(), but sometimes also model.createLiteral(contract.getProperty()) or
model.createTypedLiteral(contract.getProperty(), XSDDataType.XSDInt) and so on), I can't create my own myAddProperty() method
where I would check for null and call JENA's addProperty().
What would you suggest as a best solution to skip all the null properties?
Thanks a lot for any suggestions.
 
     
    