Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving information from different encodings #75

Open
rhaener opened this issue Oct 28, 2019 · 0 comments
Open

Retrieving information from different encodings #75

rhaener opened this issue Oct 28, 2019 · 0 comments

Comments

@rhaener
Copy link
Collaborator

rhaener commented Oct 28, 2019

Since a sustainable harmonisation of the mostly heterogeneous borehole encoding is still not implemented satisfyingly, interoperability can be achieved by providing interfaces (mappings) of the legacy formats to a suitable representation, which can be used by any client. This however, largely depends on well-designed data models. The following code snippet (Java) illustrates this problem: To retrieve a lithology-name from a GeoSciML material fragment, four tests concerning the presence of elements are necessary, whereas BML and SWE require none, which is due to the fact that especially in SWE, structure and content is clearly separated and also that cardinalities are implemented properly.

Optional getMaterial(CompositionPartPropertyType composition) {
String title = null;
CompositionPartType.Material material = composition.getCompositionPart().getMaterial();

// first test
if (material == null) {
      return Optional.ofNullable(NULL_MATERIAL);
}

CompoundMaterialType compoundMaterial = material.getCompoundMaterial();
RockMaterialType rockMaterial = (RockMaterialType) material.getCompoundMaterial();

// second  test
if (rockMaterial == null) {
    return Optional.ofNullable(NULL_MATERIAL);
}

ReferenceType lithology = rockMaterial.getLithology();

// third & fourth  test
if ((lithology != null) && (title = lithology.getTitle()) != null) {
    // finally, return the lithology name, which is the title in a GML Reference Type!!! 
    return Optional.ofNullable(title);
}

return Optional.ofNullable(NULL_MATERIAL);

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant