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

Frontend/bpmn #5

Merged
merged 25 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4a84986
Renamed skill to skill-card
aljoshakoecher Mar 29, 2022
552c325
Added a capability card to display capabilities
aljoshakoecher Mar 29, 2022
d6f9c6f
inputs and outputs are both direct children of capabilities
aljoshakoecher Mar 30, 2022
a90cbe6
Added deleteCapability functionality
aljoshakoecher Mar 30, 2022
067e589
Moved data classes that are not DTOs to frontend
aljoshakoecher Mar 30, 2022
fe524b8
Added a service locator that allows to get Angular services within da…
aljoshakoecher Mar 30, 2022
f67e600
Changed imports to new data classes
aljoshakoecher Mar 30, 2022
48447d6
Updated capability overview
aljoshakoecher Mar 30, 2022
5647ab3
Renamed skill processes to production processses
aljoshakoecher Mar 23, 2022
9a1abcb
Added type to inputs / outputs
aljoshakoecher Mar 30, 2022
e7cd0fd
Use propertyservice to get capability's properties
aljoshakoecher Mar 30, 2022
929946e
Created backend functionality to get properties
aljoshakoecher Mar 30, 2022
5a2bbd8
Defines a capability stored inside a BPMN capability task
aljoshakoecher Mar 30, 2022
0fcee0d
minor cosmetic changes
aljoshakoecher Mar 30, 2022
0e3618a
Added classes to model properties and propertyDTOs
aljoshakoecher Mar 30, 2022
7d1cc8a
Added getters for input / output properties
aljoshakoecher Mar 30, 2022
b98dfb7
Split DTO and Angular model class
aljoshakoecher Mar 30, 2022
50a6bab
Minor changes
aljoshakoecher Mar 30, 2022
afd1e96
Fixed property instance IRI
aljoshakoecher Mar 30, 2022
3b9f785
Fixed propblems on async loading
aljoshakoecher Apr 1, 2022
3808052
Removed comments
aljoshakoecher Apr 1, 2022
1dd54d7
Adds a distinction between DTO (serialized in BPMN)
aljoshakoecher Apr 1, 2022
145713e
Now getting existing values when revisiting task
aljoshakoecher Apr 1, 2022
afcaa1b
Allow passing capability type
aljoshakoecher Apr 1, 2022
5ad2e8d
Fixed skill-card component tag
aljoshakoecher Apr 1, 2022
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
Prev Previous commit
Next Next commit
Created backend functionality to get properties
  • Loading branch information
aljoshakoecher committed Mar 30, 2022
commit 929946e9e0247891aa7a71a89fe82aa36830af03
17 changes: 17 additions & 0 deletions backend/src/routes/properties/property-mappings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MappingDefinition } from "sparql-result-converter";

const propertyMapping: MappingDefinition[] = [
{
rootName: 'properties',
propertyToGroup: 'propertyInstance',
name: 'property',
toCollect: ["describedElementIri", "propertyInstance", "expressionGoal", "logicInterpretation", "value",
"propertyTypeIri", "code", "definition", "unit"],
},


];

export {
propertyMapping,
};
39 changes: 39 additions & 0 deletions backend/src/routes/properties/property.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Controller, Get, Param, Query } from "@nestjs/common";
import { PropertyDTO } from "../../models/properties/PropertyDTO";
import { PropertyService } from "./property.service";

@Controller('/properties')
export class PropertyController {

constructor(
private propertyService: PropertyService
) {}

/**
* Get all properties (of all capabilities) that are currently registered
*/
@Get()
getAllProperties(): Promise<Array<PropertyDTO>> {
return this.propertyService.getAllProperties();
}

/**
* Get a specific property by its IRI
* @param propertyIri IRI of the property to get
*/
@Get(':propertyIri')
getPropertyByIri(@Param('propertyIri') propertyIri: string): Promise<PropertyDTO> {
return this.propertyService.getPropertyByIri(propertyIri);
}


/**
* Returns all properties of a given capability
* @param capabilityIri: IRI of the capability to find properties of
*/
@Get('')
getSkillsOfCapability(@Query('capabilityIri') capabilityIri: string): Promise<PropertyDTO[]>{
return this.propertyService.getInputPropertiesOfCapability(capabilityIri);
}

}
11 changes: 11 additions & 0 deletions backend/src/routes/properties/property.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Module } from "@nestjs/common";
import { PropertyController } from "./property.controller";
import { PropertyService } from "./property.service";

@Module({
imports: [],
controllers: [PropertyController],
providers: [PropertyService],
exports: [PropertyService],
})
export class PropertyModule {}
93 changes: 93 additions & 0 deletions backend/src/routes/properties/property.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { Injectable } from "@nestjs/common";
import { SparqlResultConverter } from "sparql-result-converter";
import { GraphDbConnectionService } from "../../util/GraphDbConnection.service";
import { PropertyDTO } from "@shared/models/properties/PropertyDTO";
import { propertyMapping } from "./property-mappings";


const converter = new SparqlResultConverter();

@Injectable()
export class PropertyService {

constructor(
private graphDbConnection: GraphDbConnectionService,
) { }

async getAllProperties(): Promise<Array<PropertyDTO>> {
const queryString = `
PREFIX DINEN61360: <http://www.hsu-ifa.de/ontologies/DINEN61360#>

SELECT ?propertyInstance ?expressionGoal ?logicInterpretation ?value ?propertyType ?code ?definition ?unit WHERE {
?propertyInstance a DINEN61360:Instance_Description;
DINEN61360:Expression_Goal ?expressionGoal;
DINEN61360:Logic_Interpretation ?logicInterpretation;
^DINEN61360:has_Instance_Description ?dataElement.
OPTIONAL {
?propertyInstance DINEN61360:Value ?value.
}
?dataElement DINEN61360:has_Type_Description ?propertyType.
?propertyType DINEN61360:Code ?code;
DINEN61360:Definition ?definition.
OPTIONAL {
?propertyType DINEN61360:Unit_of_Measure ?unit.
}
}`;
const rawResult = await this.graphDbConnection.executeQuery(queryString);
const result = converter.convertToDefinition(rawResult.results.bindings, propertyMapping).getFirstRootElement() as Array<PropertyDTO>;
return result;
}

async getPropertyByIri(propertyIri: string): Promise<PropertyDTO>{
const queryString = `
PREFIX DINEN61360: <http://www.hsu-ifa.de/ontologies/DINEN61360#>

SELECT ?propertyInstance ?expressionGoal ?logicInterpretation ?value ?propertyType ?code ?definition ?unit WHERE {
?propertyInstance a DINEN61360:Instance_Description;
DINEN61360:Expression_Goal ?expressionGoal;
DINEN61360:Logic_Interpretation ?logicInterpretation;
^DINEN61360:has_Instance_Description ?dataElement.
OPTIONAL {
?propertyInstance DINEN61360:Value ?value.
}
?dataElement DINEN61360:has_Type_Description ?propertyType.
?propertyType DINEN61360:Code ?code;
DINEN61360:Definition ?definition.
OPTIONAL {
?propertyType DINEN61360:Unit_of_Measure ?unit.
}
FILTER(?propertyInstance = <${propertyIri}>)
}`;
const rawResult = await this.graphDbConnection.executeQuery(queryString);
const result = converter.convertToDefinition(rawResult.results.bindings, propertyMapping).getFirstRootElement()[0] as PropertyDTO;
return result;
}

async getInputPropertiesOfCapability(capabilityIri: string): Promise<Array<PropertyDTO>> {
const queryString = `
PREFIX DINEN61360: <http://www.hsu-ifa.de/ontologies/DINEN61360#>
PREFIX VDI3682: <http://www.hsu-ifa.de/ontologies/VDI3682#>

SELECT ?describedElementIri ?propertyInstance ?expressionGoal ?logicInterpretation ?value ?propertyTypeIri ?code ?definition ?unit WHERE {
<${capabilityIri}> VDI3682:hasInput ?describedElementIri.
?describedElementIri DINEN61360:has_Data_Element ?dataElement.
?propertyInstance a DINEN61360:Instance_Description;
DINEN61360:Expression_Goal ?expressionGoal;
DINEN61360:Logic_Interpretation ?logicInterpretation;
^DINEN61360:has_Instance_Description ?dataElement.
OPTIONAL {
?propertyInstance DINEN61360:Value ?value.
}
?dataElement DINEN61360:has_Type_Description ?propertyTypeIri.
?propertyTypeIri DINEN61360:Code ?code;
DINEN61360:Definition ?definition.
OPTIONAL {
?propertyTypeIri DINEN61360:Unit_of_Measure ?unit.
}
}`;
const rawResult = await this.graphDbConnection.executeQuery(queryString);
const result = converter.convertToDefinition(rawResult.results.bindings, propertyMapping).getFirstRootElement() as Array<PropertyDTO>;
return result;
}

}