private void addParent(Class<?> clazz, OWLClass owlClass, Session session, Map<UID, RDFSResource> resources) { RDFSClass<RDFSResource> parent = processClass(session, clazz, resources); if (parent != null) { owlClass.addSuperClass(parent); } }
public void export() { SessionFactoryImpl sessionFactory = new SessionFactoryImpl(); sessionFactory.setConfiguration(new DefaultConfiguration(RDFSClass.class.getPackage(), OWLClass.class.getPackage())); sessionFactory.setRepository(repository); sessionFactory.initialize(); Session session = sessionFactory.openSession(); if (ontology != null) { Ontology ont = new Ontology(new UID(ontology)); if (ontologyImports != null) { for (String oimport : ontologyImports) { ont.addImport(new Ontology(new UID(oimport))); } } session.save(ont); } Map<UID, RDFSResource> resources = new HashMap<UID, RDFSResource>(); resources.put(RDF.List, new RDFSClass<RDFSResource>(RDF.List)); resources.put(RDF.first, new RDFProperty(RDF.first)); resources.put(RDF.rest, new RDFProperty(RDF.rest)); resources.put(RDF.type, new RDFProperty(RDF.type)); resources.put(RDFS.label, new RDFProperty(RDFS.label)); resources.put(RDFS.comment, new RDFProperty(RDFS.comment)); resources.put(RDFS.Resource, new RDFSClass<Object>(RDFS.Resource)); // process classes for (MappedClass mappedClass : configuration.getMappedClasses()) { processClass(session, mappedClass.getJavaClass(), resources); } // save resources session.saveAll(resources.values().toArray()); }
if (property.getRange().isEmpty()) { RDFSClass<?> componentType = processClass(session, mappedProperty.getComponentType(), resources); if (useTypedLists && componentType != null) { property.addRange(new TypedList(cuid.ns(), componentType)); processClass(session, mappedProperty.getComponentType(), resources); if (componentType != null) { RDFSClass<?> range = processClass(session, mappedProperty.getType(), resources); if (range != null) {