-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
2,083 additions
and
938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"enabler": "Stellio context broker", | ||
"chapter": "core", | ||
"academy": "", | ||
"readthedocs": "stellio", | ||
"helpdesk": "", | ||
"coveralls": "", | ||
"github": ["stellio-hub/stellio-context-broker"], | ||
"dockerregistry": ["hub.docker.com"], | ||
"docker": [ | ||
"stellio/stellio-search-service", | ||
"stellio/stellio-subscription-service", | ||
"stellio/stellio-entity-service", | ||
"stellio/stellio-api-gateway" | ||
], | ||
"email": "[email protected]", | ||
"status": "incubating", | ||
"compose": "https://raw.githubusercontent.com/stellio-hub/stellio-context-broker/develop/docker-compose.yml", | ||
"exclude": ["zookeeper", "kafka", "neo4j", "postgres"], | ||
"stackexchange": ["https://stackoverflow.com/questions/tagged/fiware-stellio"], | ||
"unit-test": "", | ||
"smoke-test": "", | ||
"dockerfile": [ | ||
"https://github.com/stellio-hub/stellio-context-broker/blob/develop/api-gateway", | ||
"https://github.com/stellio-hub/stellio-context-broker/blob/develop/entity-service", | ||
"https://github.com/stellio-hub/stellio-context-broker/blob/develop/search-service", | ||
"https://github.com/stellio-hub/stellio-context-broker/blob/develop/subscription-service" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
entity-service/src/main/kotlin/com/egm/stellio/entity/config/AsynchronousEventsConfig.kt
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
entity-service/src/main/kotlin/com/egm/stellio/entity/model/AttributeDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.egm.stellio.entity.model | ||
|
||
import java.net.URI | ||
|
||
data class AttributeDetails( | ||
val id: URI, | ||
val type: String = "Attribute", | ||
val attributeName: String, | ||
val typeNames: List<String> | ||
) |
11 changes: 11 additions & 0 deletions
11
entity-service/src/main/kotlin/com/egm/stellio/entity/model/AttributeList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.egm.stellio.entity.model | ||
|
||
import com.egm.stellio.shared.util.toUri | ||
import java.net.URI | ||
import java.util.* | ||
|
||
class AttributeList( | ||
val id: URI = "urn:ngsi-ld:AttributeList:${UUID.randomUUID()}".toUri(), | ||
val type: String = "AttributeList", | ||
val attributeList: List<String> | ||
) |
12 changes: 12 additions & 0 deletions
12
entity-service/src/main/kotlin/com/egm/stellio/entity/model/AttributeTypeInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.egm.stellio.entity.model | ||
|
||
import java.net.URI | ||
|
||
class AttributeTypeInfo( | ||
val id: URI, | ||
val type: String = "Attribute", | ||
val attributeName: String, | ||
val attributeTypes: List<String>, | ||
val typeNames: List<String>, | ||
val attributeCount: Int | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
entity-service/src/main/kotlin/com/egm/stellio/entity/service/AttributeService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.egm.stellio.entity.service | ||
|
||
import com.egm.stellio.entity.model.* | ||
import com.egm.stellio.entity.repository.Neo4jRepository | ||
import com.egm.stellio.shared.util.JsonLdUtils.compactTerm | ||
import com.egm.stellio.shared.util.toUri | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class AttributeService( | ||
private val neo4jRepository: Neo4jRepository | ||
) { | ||
|
||
fun getAttributeList(contexts: List<String>): AttributeList = | ||
AttributeList( | ||
attributeList = neo4jRepository.getAttributes().map { compactTerm(it, contexts) } | ||
) | ||
|
||
fun getAttributeDetails(contexts: List<String>): List<AttributeDetails> = | ||
neo4jRepository.getAttributesDetails().map { | ||
val attribute = (it["attribute"] as String) | ||
AttributeDetails( | ||
id = attribute.toUri(), | ||
attributeName = compactTerm(attribute, contexts), | ||
typeNames = (it["typeNames"] as Set<String>).toList().map { compactTerm(it, contexts) } | ||
) | ||
} | ||
|
||
fun getAttributeTypeInfo(expandedType: String): AttributeTypeInfo? { | ||
val attributesInformation = neo4jRepository.getAttributeInformation(expandedType) | ||
if (attributesInformation.isEmpty()) return null | ||
|
||
return AttributeTypeInfo( | ||
id = expandedType.toUri(), | ||
attributeName = attributesInformation["attributeName"] as String, | ||
attributeTypes = attributesInformation["attributeTypes"] as List<String>, | ||
typeNames = attributesInformation["typeNames"] as List<String>, | ||
attributeCount = attributesInformation["attributeCount"] as Int | ||
) | ||
} | ||
} |
Oops, something went wrong.