Creating Modules in dng using OSLC
2 answers
Module is not part of the OSLC specification. You can take a look at the new Module API introduced in DNG 6.0.5.
https://jazz.net/wiki/bin/view/Main/DNGModuleApiOverview
https://jazz.net/wiki/bin/view/Main/DNGModuleAPI
Here's the sketch of an algorithm:
find the URI of the ResourceShape for the InstanceShape of your new Module;
find the URI of the Parent folder for the new Module;
find the URI of the ProjectArea Component that the new Module will be within;
Response postResponse = Stream.of( componentUri )
.map( cu -> OslcOauthGet( cu ) )
.map( cmp -> cmp.getServiceProvider() )
.map( spu -> OslcOauthGet( spu ) )
.flatMap( sp -> Arrays.stream( sp.getServices() ) )
.flatMap( srv -> srv.getCreationFactories() )
.filter( cf -> isForOslcComponent( componentUri ) )
.filter( cf -> isForRdfType( "http://open-services.net/ns/rm#RequirementCollection" ) )
.filter( cf -> cf.getCreation() ) .first()
.map( cfu -> {
blankNodeModule = RdfXmlModule.newForType( "http://jazz.net/ns/rm#Module" ).parent( parentUri ).shape( moduleInstanceShapeUri ).title( "My New Module" );
return OslcOauthPost( cfu ).body( blankNodeModule ).type( TextTurtle etc );
} )
.orElseThrow( "ask for help, don't give up hope. this can be done." );