0

I have in my asset "AirPollution" some concept e.g "CarbonMonoxide". But if i call rest-composer-server in terminal, it gives me some error:

REST server error

Here my code snippet:

asset AirPollutionData identified by airPollutionDataId {
  o String airPollutionDataId
  o String location
  o DateTime datetime
  o TransferStatus status default="FOR_SALE"
  o CO co
  o NO2 no2
  o O3 o3
  o PM10 pm10
  o PM25 pm25
  o SO2 so2
  --> Member owner
}

concept CO {
  o String pollutant_description default="Carbon monoxide"
  o String units default="ppb"
  o Double concentration 
}  

concept NO2 {
  o String pollutant_description default="Nitrogen dioxide"
  o String units default="ppb"
  o Double concentration
}

concept O3 {
  o String pollutant_description default="Ozone"
  o String units default="ppb"
  o Double concentration
}
  
concept PM10 {
  o String pollutant_description default="Inhalable particulate matter (<10µm)"
  o String units default="ug/m3"
  o Double concentration
}

concept PM25 {
  o String pollutant_description default="Fine particulate matter (<2.5µm)"
  o String units default="ug/m3"
  o Double concentration
}
  
concept SO2 {
  o String pollutant_description default="Sulfur dioxide"
  o String units default="ug/m3"
  o Double concentration
}  

What is gone wrong here? And in my primitive angular app, if i want to add asset, i don't see the default valeus from concepts e.g pollutant_description or units.

Here is what I meant:default values gone

1 Answers1

0

It worked for me. See screenshots below of created AirPollutionData asset.

The Swagger messages are simply that Concepts are ignored (they are not resource endpoints).

The model you posted had errors:

You're missing definitions for these two below (I created these samples, just to get it to work):

concept TransferStatus {
    o String id
}
participant Member identified by id {
   o String id
}

enter image description here

enter image description here

{ "$class": "org.acme.trading.AirPollutionData", "airPollutionDataId": "3941", "location": "Labore nisi esse incididunt non.", "datetime": "2018-03-05T16:59:23.239Z", "status": { "$class": "org.acme.trading.TransferStatus", "id": "In aute." }, "co": { "$class": "org.acme.trading.CO", "pollutant_description": "Carbon monoxide", "units": "ppb", "concentration": 248.394 }, "no2": { "$class": "org.acme.trading.NO2", "pollutant_description": "Nitrogen dioxide", "units": "ppb", "concentration": 50.636 }, "o3": { "$class": "org.acme.trading.O3", "pollutant_description": "Ozone", "units": "ppb", "concentration": 144.997 }, "pm10": { "$class": "org.acme.trading.PM10", "pollutant_description": "Inhalable particulate matter (<10µm)", "units": "ug/m3", "concentration": 0.595 }, "pm25": { "$class": "org.acme.trading.PM25", "pollutant_description": "Fine particulate matter (<2.5µm)", "units": "ug/m3", "concentration": 60.074 }, "so2": { "$class": "org.acme.trading.SO2", "pollutant_description": "Sulfur dioxide", "units": "ug/m3", "concentration": 189.644 }, "owner": "resource:org.acme.trading.Member#1" }

As for defaults not showing in Angular generated fields - I will find out. The defaults are available in Playground for sure, but not sure these are available in the skeleton app (that's exactly what it is, something for the developer to take forth). Will edit this when I know more on this.

Paul O'Mahony
  • 6,740
  • 1
  • 10
  • 15
  • how can i get it work on angular front-end? I mean, i see there just a field and not my default strings such as "carbon Monoxide" or "ppb". Please see the screenshot below: https://i.stack.imgur.com/SisAv.png – kerberos17 Mar 05 '18 at 17:27
  • hi there, presently the skeleton Angular app does not show the defaults if set in the model (it does do, in Playground). If you would like to raise an issue and/or contribute towards it taking the defaults from the models in the Angular app, please raise an issue here -> https://github.com/hyperledger/composer/issues/ thank you – Paul O'Mahony Mar 06 '18 at 16:17
  • It has been confirmed, what you wrote. see the screenshot below: https://imgur.com/a/IsiKl The skeleton angular app can't show it, if in assets e.g concepts are included. Transactions and participants are not created by composer, which is not so optimal. So what other possibilities do I have, if I want to create a very simple front-end app to do rest api calls with it? I'm not a developer at all, so unfortunately I have no idea how to do that. I can just some java and php, but absolutely no idea of front end development things. – kerberos17 Mar 06 '18 at 21:23