/** Explicitly removes the concept from the entity. */ public void removeDesignation(Object entity, Class<?> concept) throws RepositoryException { Resource resource = findResource(entity); URI type = of.getNameOf(concept); if (type == null) { throw new ObjectPersistException( "Concept is anonymous or is not registered: " + concept.getSimpleName()); } types.removeTypeStatement(resource, type); cachedObjects.remove(resource); }
private <C extends Collection<URI>> C addConcept(Resource resource, Class<?> role, C set) throws RepositoryException { URI type = of.getNameOf(role); if (type == null) { throw new ObjectPersistException( "Concept is anonymous or is not registered: " + role.getSimpleName()); } types.addTypeStatement(resource, type); set.add(type); return set; }
private <C extends Collection<URI>> C getTypes(Class<?> role, C set) throws RepositoryException { URI type = of.getNameOf(role); if (type == null) { Class<?> superclass = role.getSuperclass(); if (superclass != null) { getTypes(superclass, set); } Class<?>[] interfaces = role.getInterfaces(); for (int i = 0, n = interfaces.length; i < n; i++) { getTypes(interfaces[i], set); } } else { set.add(type); } return set; }