private static void addTypeToAll(Resource type, Set<Resource> candidates) {
   List<Resource> types = equivalentTypes(type);
   for (Resource element : candidates) {
     Resource resource = element;
     for (int i = 0; i < types.size(); i += 1) resource.addProperty(RDF.type, types.get(i));
   }
 }
  public static void main(String args[]) {
    // create an empty model
    Model model = ModelFactory.createDefaultModel();

    // create the resource
    Resource johnSmith = model.createResource(personURI);

    // add the property
    johnSmith.addProperty(VCARD.FN, fullName);
  }
 private static List<Resource> equivalentTypes(Resource type) {
   List<Resource> types = new ArrayList<Resource>();
   types.add(type);
   for (StmtIterator it = type.getModel().listStatements(ANY, OWL.equivalentClass, type);
       it.hasNext(); ) types.add(it.nextStatement().getSubject());
   return types;
 }
 private static List<RDFNode> asJavaList(Resource resource) {
   return (resource.as(RDFList.class)).asJavaList();
 }
 private static void removeElementsWithoutType(Set<Resource> candidates, Resource type) {
   for (Iterator<Resource> it = candidates.iterator(); it.hasNext(); ) {
     Resource candidate = it.next();
     if (!candidate.hasProperty(RDF.type, type)) it.remove();
   }
 }