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

Update OWL2JAVA #60

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@
<Declaration>
<Class IRI="http://graph.clouditor.io/classes/FileStorage"/>
</Declaration>
<Declaration>
<Class IRI="http://graph.clouditor.io/classes/FileStorageService"/>
</Declaration>
<Declaration>
<Class IRI="http://graph.clouditor.io/classes/Firewall"/>
</Declaration>
<Declaration>
<Class IRI="http://graph.clouditor.io/classes/Framework"/>
</Declaration>
Expand Down Expand Up @@ -305,6 +311,9 @@
<Declaration>
<ObjectProperty IRI="http://graph.clouditor.io/classes/offersInterface"/>
</Declaration>
<Declaration>
<ObjectProperty IRI="http://graph.clouditor.io/classes/offersMultiple"/>
</Declaration>
<Declaration>
<ObjectProperty IRI="http://graph.clouditor.io/classes/output"/>
</Declaration>
Expand Down Expand Up @@ -371,6 +380,9 @@
<Declaration>
<DataProperty IRI="http://graph.clouditor.io/classes/mixedDuties"/>
</Declaration>
<Declaration>
<DataProperty IRI="http://graph.clouditor.io/classes/monitoringEnabled"/>
</Declaration>
<Declaration>
<DataProperty IRI="http://graph.clouditor.io/classes/mutual"/>
</Declaration>
Expand Down Expand Up @@ -398,6 +410,9 @@
<Declaration>
<DataProperty IRI="http://graph.clouditor.io/classes/runtimeVersion"/>
</Declaration>
<Declaration>
<DataProperty IRI="http://graph.clouditor.io/classes/securityAlertsEnabled"/>
</Declaration>
<Declaration>
<DataProperty IRI="http://graph.clouditor.io/classes/securityOnly"/>
</Declaration>
Expand Down Expand Up @@ -659,9 +674,6 @@
<Declaration>
<NamedIndividual abbreviatedIRI="library:SpringBootRequestMapping"/>
</Declaration>
<Declaration>
<AnnotationProperty IRI="http://purl.org/dc/elements/1.1/description"/>
</Declaration>
<Declaration>
<AnnotationProperty abbreviatedIRI="rdfs:type"/>
</Declaration>
Expand Down Expand Up @@ -797,6 +809,20 @@
<Class IRI="http://graph.clouditor.io/classes/Backup"/>
<Class IRI="http://graph.clouditor.io/classes/Availability"/>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Backup"/>
<ObjectSomeValuesFrom>
<ObjectProperty IRI="http://graph.clouditor.io/classes/offersInterface"/>
<Class IRI="http://graph.clouditor.io/classes/TransportEncryption"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Backup"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:has"/>
<Class IRI="http://graph.clouditor.io/classes/Storage"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Backup"/>
<DataSomeValuesFrom>
Expand All @@ -806,10 +832,10 @@
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Backup"/>
<DataSomeValuesFrom>
<DataProperty abbreviatedIRI="prop:policy"/>
<Datatype abbreviatedIRI="xsd:string"/>
</DataSomeValuesFrom>
<DataHasValue>
<DataProperty IRI="http://graph.clouditor.io/classes/interval"/>
<Literal>xsd:java.time.Duration</Literal>
</DataHasValue>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Backup"/>
Expand Down Expand Up @@ -877,6 +903,13 @@
<Class IRI="http://graph.clouditor.io/classes/NetworkInterface"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Compute"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:offers"/>
<Class IRI="http://graph.clouditor.io/classes/ResourceLogging"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Confidentiality"/>
<Class IRI="http://graph.clouditor.io/classes/SecurityFeature"/>
Expand Down Expand Up @@ -1007,6 +1040,28 @@
<Class IRI="http://graph.clouditor.io/classes/FileStorage"/>
<Class IRI="http://graph.clouditor.io/classes/Storage"/>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/FileStorage"/>
<DataSomeValuesFrom>
<DataProperty IRI="http://graph.clouditor.io/classes/publicAccess"/>
<Datatype abbreviatedIRI="xsd:boolean"/>
</DataSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/FileStorageService"/>
<Class IRI="http://graph.clouditor.io/classes/StorageService"/>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/FileStorageService"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:offers"/>
<Class IRI="http://graph.clouditor.io/classes/HttpEndpoint"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Firewall"/>
<Class IRI="http://graph.clouditor.io/classes/AccessRestriction"/>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Framework"/>
<Class abbreviatedIRI="owl:Thing"/>
Expand Down Expand Up @@ -1249,7 +1304,7 @@
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/JwtBasedAuthentication"/>
<DataSomeValuesFrom>
<DataProperty abbreviatedIRI="prop:activated"/>
<DataProperty abbreviatedIRI="prop:enabled"/>
<Datatype abbreviatedIRI="xsd:boolean"/>
</DataSomeValuesFrom>
</SubClassOf>
Expand All @@ -1266,7 +1321,7 @@
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/L3Firewall"/>
<Class IRI="http://graph.clouditor.io/classes/AccessRestriction"/>
<Class IRI="http://graph.clouditor.io/classes/Firewall"/>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/L3Firewall"/>
Expand Down Expand Up @@ -1296,7 +1351,7 @@
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/LoadBalancer"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:hasMultiple"/>
<ObjectProperty IRI="http://graph.clouditor.io/classes/offersInterface"/>
<Class IRI="http://graph.clouditor.io/classes/AccessRestriction"/>
</ObjectSomeValuesFrom>
</SubClassOf>
Expand Down Expand Up @@ -1361,6 +1416,20 @@
<Class IRI="http://graph.clouditor.io/classes/LoggingService"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Logging"/>
<DataSomeValuesFrom>
<DataProperty IRI="http://graph.clouditor.io/classes/monitoringEnabled"/>
<Datatype abbreviatedIRI="xsd:boolean"/>
</DataSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Logging"/>
<DataSomeValuesFrom>
<DataProperty IRI="http://graph.clouditor.io/classes/securityAlertsEnabled"/>
<Datatype abbreviatedIRI="xsd:boolean"/>
</DataSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Logging"/>
<DataSomeValuesFrom>
Expand Down Expand Up @@ -1433,15 +1502,15 @@
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/NetworkInterface"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:has"/>
<Class IRI="http://graph.clouditor.io/classes/NetworkService"/>
<ObjectProperty IRI="http://graph.clouditor.io/classes/offersInterface"/>
<Class IRI="http://graph.clouditor.io/classes/AccessRestriction"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/NetworkInterface"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:offers"/>
<Class IRI="http://graph.clouditor.io/classes/AccessRestriction"/>
<ObjectProperty abbreviatedIRI="prop:has"/>
<Class IRI="http://graph.clouditor.io/classes/NetworkService"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
Expand Down Expand Up @@ -1643,13 +1712,27 @@
<Class IRI="http://graph.clouditor.io/classes/AtRestEncryption"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Storage"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:hasMultiple"/>
<Class IRI="http://graph.clouditor.io/classes/Backup"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Storage"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:offers"/>
<Class IRI="http://graph.clouditor.io/classes/Immutability"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/Storage"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="prop:offers"/>
<Class IRI="http://graph.clouditor.io/classes/ResourceLogging"/>
</ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/StorageService"/>
<Class IRI="http://graph.clouditor.io/classes/NetworkService"/>
Expand Down Expand Up @@ -1746,7 +1829,7 @@
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/WebApplicationFirewall"/>
<Class IRI="http://graph.clouditor.io/classes/AccessRestriction"/>
<Class IRI="http://graph.clouditor.io/classes/Firewall"/>
</SubClassOf>
<SubClassOf>
<Class IRI="http://graph.clouditor.io/classes/WebApplicationFirewall"/>
Expand Down Expand Up @@ -2265,6 +2348,11 @@ name = metadata.name</Literal>
<IRI>http://graph.clouditor.io/classes/Availability</IRI>
<Literal xml:lang="english">Availability</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:comment"/>
<IRI>http://graph.clouditor.io/classes/Backup</IRI>
<Literal>RetentionPeriod in hours</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/Backup</IRI>
Expand Down Expand Up @@ -2395,6 +2483,21 @@ name = metadata.name</Literal>
<IRI>http://graph.clouditor.io/classes/FileStorage</IRI>
<Literal xml:lang="english">FileStorage</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:comment"/>
<IRI>http://graph.clouditor.io/classes/FileStorageService</IRI>
<Literal>An file storage service represents the network service that is used to access a list of file storage shares. The storage itself is modelled as a FileStorage. The service has an http endpoint.</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/FileStorageService</IRI>
<Literal>FileStorageService</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/Firewall</IRI>
<Literal>Firewall</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/Framework</IRI>
Expand Down Expand Up @@ -2790,6 +2893,11 @@ name = metadata.name</Literal>
<IRI>http://graph.clouditor.io/classes/mixedDuties</IRI>
<Literal>mixedDuties</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/monitoringEnabled</IRI>
<Literal>monitoringLogDataEnabled</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/mutual</IRI>
Expand All @@ -2805,6 +2913,16 @@ name = metadata.name</Literal>
<IRI>http://graph.clouditor.io/classes/offersInterface</IRI>
<Literal>offersInterface</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:comment"/>
<IRI>http://graph.clouditor.io/classes/offersMultiple</IRI>
<Literal>If a property is a security feature.</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/offersMultiple</IRI>
<Literal>offersMultiple</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/output</IRI>
Expand Down Expand Up @@ -2845,6 +2963,11 @@ name = metadata.name</Literal>
<IRI>http://graph.clouditor.io/classes/runtimeVersion</IRI>
<Literal>runtimeVersion</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/securityAlertsEnabled</IRI>
<Literal>securityAlertsEnabled</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>http://graph.clouditor.io/classes/securityOnly</IRI>
Expand Down Expand Up @@ -3245,6 +3368,11 @@ name = metadata.name</Literal>
<AbbreviatedIRI>prop:modify</AbbreviatedIRI>
<Literal>modify</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:comment"/>
<AbbreviatedIRI>prop:offers</AbbreviatedIRI>
<Literal>If a property is a security feature.</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<AbbreviatedIRI>prop:offers</AbbreviatedIRI>
Expand Down
22 changes: 13 additions & 9 deletions owl2java/src/main/kotlin/io/clouditor/graph/OWLCloudOntology.kt
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class OWLCloudOntology(filepath: String, private val resourceNameFromOwlFile: St
property.propertyName = decapitalizeString(formatString(getClassName(superClass, ontology)))
property.propertyType = formatString(getClassName(superClass, ontology))
}
"hasMultiple" -> {
"hasMultiple", "offersMultiple" -> {
property.propertyName = getPlural(decapitalizeString(formatString(getClassName(superClass, ontology))))
property.propertyType = formatString(getClassName(superClass, ontology))
}
Expand Down Expand Up @@ -495,12 +495,12 @@ class OWLCloudOntology(filepath: String, private val resourceNameFromOwlFile: St
formatString(getClassName(superClass, ontology)),
decapitalizeString(formatString(getClassName(superClass, ontology)))
)
"hasMultiple" -> javaClass.addProperty(
"hasMultiple", "offersMultiple" -> javaClass.addProperty(
formatString(getArrayClassName(superClass, ontology)),
decapitalizeString(formatString(getPlural(getClassName(superClass, ontology))))
)
else -> // TODO: store this information in the property itself, i.e. if it is an array or not. for now all are arrays
javaClass.addProperty(
// TODO: store this information in the property itself, i.e. if it is an array or not. for now all are arrays
else -> javaClass.addProperty(
formatString(getArrayClassName(superClass, ontology)),
classRelationshipPropertyName
)
Expand Down Expand Up @@ -643,7 +643,7 @@ class OWLCloudOntology(filepath: String, private val resourceNameFromOwlFile: St
return ""
}

// Get description from a data property, e.g., interval
// Get description from a DATA property, e.g., interval
private fun getDataPropertyDescription(ontology: OWLOntology?, props: MutableSet<OWLDataProperty>): String {
val description: String

Expand All @@ -669,19 +669,23 @@ class OWLCloudOntology(filepath: String, private val resourceNameFromOwlFile: St
return nce.filler.toString().split(":").toTypedArray()[1]
}

// Get class data property name (realtionship in OWL)
// Get class DATA property name (realtionship in OWL)
private fun getClassDataPropertyName(nce: OWLClassExpression): String {
for (elem in nce.dataPropertiesInSignature) {
return elem.iri.fragment
for (item in EntitySearcher.getAnnotationObjects(elem, ontology!!)) {
if (item != null && item.property.iri.remainder.get() == "label"){
return item.value.toString().split("\"").toTypedArray()[1]
}
}
}
return ""
}

// Get class object property name (realtionship in owl)
// Get class OBJECT property name (realtionship in owl)
private fun getClassObjectPropertyName(nce: OWLClassExpression): String {
for (elem in nce.objectPropertiesInSignature) {
for (item in EntitySearcher.getAnnotationObjects(elem, ontology!!)) {
if (item != null) {
if (item != null && item.property.iri.remainder.get() == "label"){
return item.value.toString().split("\"").toTypedArray()[1]
}
}
Expand Down
Loading
Loading