ImageMetadata

Hello everyone,

I have been experimenting with ImageMetadata from the standard libraries, and I am currently struggling to understand what I may be doing wrong. My goal is to attach an icon or image-related metadata to a usage so that it can be represented visually.

I created the example below to test this. I expected the metadata to be associated with the usage, but when I created a view and dragged the usage onto it, I was not able to see any visual result.

Could someone please let me know whether:

  • my use of ImageMetadata and SemanticMetadata is incorrect,

  • the metadata is attached correctly but not rendered in the view,

  • or whether attaching an icon to a usage is not currently supported in this way?

Any guidance would be greatly appreciated.

Thank you in advance,
Ajay

library package T_Library {
    private import SysML::*;
    private import Metaobjects::*;
    private import ScalarValues::*;
    private import ImageMetadata::*;

    attribute def Image_A :> Image {
        :>> content = "<<encoded image here>>";
        :>> encoding = "base64";  
        :>> type = "image/png";

    }

    attribute def Rationale_A {
        attribute text : String default "text here";
        attribute explanation : String default "explanation here";
    }

    part def A {
        attribute image : Image_A;
        attribute rationale : Rationale_A;
        attribute id : String;
    }

    part a : A [*];

    metadata def Testing :> SemanticMetadata {
        :>> baseType = a meta Usage;
        :>> annotatedElement : PartUsage;
    }
}

package Test_Usage {
    private import T_Library::*;

    #Testing part RandomPart {
        :>> id = "RP01";
    }
}

//since I didn’t have an advanced plan, I checked whether this works by creating a view and dragging the usage(RandomPart) onto it, but I was not able to see anything.

Hi Ajay,

I do not see anything wrong with how you used SemanticMetadata, and the RandomPart does inherit things correctly from the part def A.

However, rendering of images encoded in SysMLv2 itself is not supported at this time.

Kind regards,
Simonas

Hi Simonas,
Thank you for the clarification :blush: