use of eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About in project hale by halestudio.
the class OmlRdfReader method getRelation.
/**
* Implements casting from the JAXB-Type to the OML Type for the Relation
* element.
*
* @param relation jaxb-generated object
* @return omlRelation
*/
private Relation getRelation(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.RelationType relation) {
Relation omlRelation = new Relation(new About(""));
if (relation != null) {
// set about
if (relation.getAbout() != null && !relation.getAbout().equals("")) {
omlRelation.setAbout(new About(relation.getAbout()));
}
// set domain restriction
if (relation.getDomainRestriction() != null) {
FeatureClass domainRestriction = getDomainRestriction(relation.getDomainRestriction());
ArrayList<FeatureClass> domainRestrictions = new ArrayList<FeatureClass>();
domainRestrictions.add(domainRestriction);
omlRelation.setDomainRestriction(domainRestrictions);
}
// set label
if (relation.getLabel() != null && relation.getLabel().size() > 0) {
omlRelation.setLabel(relation.getLabel());
}
// set transformation
if (relation.getTransf() != null) {
omlRelation.setTransformation(getTransformation(relation.getTransf()));
}
// set Range Restriction
if (relation.getRangeRestriction() != null) {
FeatureClass omlRangeRestriction = getRangeRestriction(relation.getRangeRestriction());
List<FeatureClass> omlRangeRestrictions = new ArrayList<FeatureClass>();
omlRangeRestrictions.add(omlRangeRestriction);
omlRelation.setRangeRestriction(omlRangeRestrictions);
}
}
return omlRelation;
}
use of eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About in project hale by halestudio.
the class OmlRdfReader method getCell.
/**
* converts from {@link CellType} to {@link Cell}
*
* @param cell
* @return
*/
private Cell getCell(CellType cellType) {
Cell cell = new Cell();
List<String> labels = cellType.getLabel();
if (labels != null) {
cell.setLabel(labels);
}
// TODO check with Marian set about as UUID from string about
// cell.setAbout(new About(UUID.fromString(cellType.getAbout())));
About about = new About(UUID.randomUUID());
if (cellType.getAbout() != null) {
about.setAbout(cellType.getAbout());
}
cell.setAbout(about);
// set entity1
if (cellType.getEntity1() != null) {
cell.setEntity1(getEntity(cellType.getEntity1().getEntity()));
}
// set entity2
if (cellType.getEntity2() != null) {
cell.setEntity2(getEntity(cellType.getEntity2().getEntity()));
}
// Measure is optional
if (cellType.getMeasure() != null) {
cell.setMeasure(cellType.getMeasure());
}
// Relation is optional
if (cellType.getRelation() != null) {
cell.setRelation(getRelation(cellType.getRelation()));
}
return cell;
}
use of eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About in project hale by halestudio.
the class FeatureClass method deepCopy.
@Override
public IEntity deepCopy() {
FeatureClass result = new FeatureClass(new About(this.getAbout().getAbout()));
Transformation t = new Transformation(this.getTransformation().getService());
List<IParameter> parameters = new ArrayList<IParameter>();
for (IParameter p : this.getTransformation().getParameters()) {
parameters.add(new Parameter(p.getName(), p.getValue()));
}
t.setParameters(parameters);
result.setTransformation(t);
List<String> newLabels = new ArrayList<String>();
for (String label : this.getLabel()) {
newLabels.add(label);
}
result.setLabel(newLabels);
return result;
}
use of eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About in project hale by halestudio.
the class Property method deepCopy.
@Override
public IEntity deepCopy() {
Property result = new Property(new About(this.getAbout().getAbout()));
Transformation t = new Transformation(this.getTransformation().getService());
List<IParameter> parameters = new ArrayList<IParameter>();
for (IParameter p : this.getTransformation().getParameters()) {
parameters.add(new Parameter(p.getName(), p.getValue()));
}
t.setParameters(parameters);
result.setTransformation(t);
List<String> newLabels = new ArrayList<String>();
for (String label : this.getLabel()) {
newLabels.add(label);
}
result.setLabel(newLabels);
return result;
}
Aggregations