public ClassMappingImpl(UID id, Class<?> parent) { this(id.getNamespace(), id.getLocalName(), parent); }
private String getClassName(UID classId) { String localName = normalize(classId.getLocalName()); if (nsToClassPrefix.containsKey(classId.getNamespace())) { localName = nsToClassPrefix.get(classId.getNamespace()) + localName; } return localName; }
private String getPropertyName(UID propertyId) { String propertyName = normalize(propertyId.getLocalName()); if (nsToPropertyPrefix.containsKey(propertyId.getNamespace())) { propertyName = nsToPropertyPrefix.get(propertyId.getNamespace()) + StringUtils.capitalize(propertyName); } else if (stripHasOff && propertyName.startsWith("has") && propertyName.length() > 3) { propertyName = StringUtils.uncapitalize(propertyName.substring(3)); } return propertyName; }
private Property createProperty(EntityType entityType, UID entityId, RDFProperty rdfProperty, @Nullable RDFSClass<?> range) { UID propertyId = rdfProperty.getId().asURI(); Type propertyType = getPropertyType(rdfProperty, range); String propertyName = getPropertyName(propertyId); Property property = new Property(entityType, propertyName, propertyType); if (propertyId.getNamespace().equals(entityId.getNamespace())) { if (propertyName.equals(propertyId.getLocalName())) { property.addAnnotation(new PredicateImpl("", "", "", false)); } else { property.addAnnotation(new PredicateImpl("", "", propertyId.getLocalName(), false)); } } else { property.addAnnotation(new PredicateImpl("", propertyId, false)); } return property; }
resources.put(cuid, owlClass); owlClass.setLabel(Locale.ROOT, cuid.getLocalName()); } else { return owlClass;
private EntityType createEnumType(RDFSClass<?> rdfType) { // EnumType enumType = new EnumType(classId, getPackage(classId), // getClassName(classId)); // for (Object object : rdfType.getOneOf()){ // if (object instanceof MappedResourceBase && // ((MappedResourceBase)object).getId().isURI()){ // UID id = (UID) ((MappedResourceBase)object).getId(); // enumType.addEnum(id.getLocalName()); // } // } // return enumType; // type UID id = rdfType.getId().asURI(); String pkgName = getPackage(id); String simpleName = getClassName(id); Type type = new SimpleType(TypeCategory.ENTITY, pkgName + "." + simpleName, pkgName, id.getLocalName(), false, false); uidToType.put(id, type); EntityType entityType = new EntityType(type); entityType.addAnnotation(new ClassMappingImpl(id.getNamespace(), "", Object.class)); return entityType; }
String pkgName = getPackage(id); String simpleName = getClassName(id); Type type = new SimpleType(TypeCategory.ENTITY, pkgName + "." + simpleName, pkgName, id.getLocalName(), false, false); uidToType.put(id, type); EntityType entityType = new EntityType(type);
@Test public void UIDString() { UID uid = new UID(RDF.type.getId()); assertEquals(RDF.NS, uid.getNamespace()); assertEquals("type", uid.getLocalName()); }
property = new DatatypeProperty(puid); property.setLabel(Locale.ROOT, puid.getLocalName()); resources.put(puid, property);