@OslcCreationFactory(
     title = "SysML PartProperty Creation Factory",
     label = "SysML PartProperty Creation",
     resourceShapes = {
       OslcConstants.PATH_RESOURCE_SHAPES + "/" + Constants.PATH_SYSML_PARTPROPERTY
     },
     resourceTypes = {Constants.TYPE_SYSML_PARTPROPERTY},
     usages = {OslcConstants.OSLC_USAGE_DEFAULT})
 @POST
 @Consumes({
   OslcMediaType.APPLICATION_RDF_XML,
   OslcMediaType.APPLICATION_XML,
   OslcMediaType.APPLICATION_JSON
 })
 @Produces({
   OslcMediaType.APPLICATION_RDF_XML,
   OslcMediaType.APPLICATION_XML,
   OslcMediaType.APPLICATION_JSON
 })
 public Response addPartProperty(
     @PathParam("projectId") final String projectId, final SysMLPartProperty sysmlPart)
     throws IOException, ServletException {
   //		MagicDrawManager.loadSysMLProjects();
   MagicDrawManager.makeSysMLProjectActive(projectId);
   // creating the element in MagicDraw
   MagicDrawManager.createSysMLPartProperty(sysmlPart, projectId);
   URI about = sysmlPart.getAbout();
   return Response.created(about).entity(sysmlPart).build();
 }
  @POST
  @Produces(MediaType.TEXT_HTML)
  public void addPartFromHtmlForm(
      @PathParam("projectId") final String projectId,
      @FormParam("name") final String elementName,
      @FormParam("lower") final String lower,
      @FormParam("upper") final String upper,
      @FormParam("type") final String type,
      @FormParam("ownerElement") final String ownerElement)
      throws IOException, ServletException {

    MagicDrawManager.loadSysMLProjects();

    SysMLPartProperty newSysMLPart;
    try {
      newSysMLPart = new SysMLPartProperty();
      newSysMLPart.setName(elementName);
      newSysMLPart.setLower(lower);
      newSysMLPart.setUpper(upper);

      // owner
      // Unparse owner element string
      String[] ownerElementStrings = ownerElement.split("_");
      String ownerName = ownerElementStrings[ownerElementStrings.length - 1];
      ownerName = ownerName.replaceAll("\\n", "-").replaceAll(" ", "_");
      URI ownerURI =
          URI.create(
              MagicDrawManager.baseHTTPURI + "/services/" + projectId + "/blocks/" + ownerName);
      newSysMLPart.setOwner(ownerURI);

      // URI
      URI elementURI =
          URI.create(
              MagicDrawManager.baseHTTPURI
                  + "/services/"
                  + projectId
                  + "/parts/"
                  + ownerName
                  + "::"
                  + elementName);
      newSysMLPart.setAbout(elementURI);

      // type
      String[] typeElementStrings = type.split("_");
      String typeQualifiedName = typeElementStrings[typeElementStrings.length - 1];
      URI typeURI = MagicDrawManager.getURIFromQualifiedName(typeQualifiedName);
      newSysMLPart.setType(typeURI);

      MagicDrawManager.createSysMLPartProperty(newSysMLPart, projectId);
    } catch (URISyntaxException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    try {

      httpServletRequest.setAttribute("elementType", "PartProperty");
      httpServletRequest.setAttribute("createdElement", elementName);
      httpServletRequest.setAttribute("projectId", projectId);
      httpServletRequest.setAttribute("portNumber", OSLC4JMagicDrawApplication.portNumber);
      RequestDispatcher rd =
          httpServletRequest.getRequestDispatcher("/sysml/sysml_creationConfirmation.jsp");
      rd.forward(httpServletRequest, httpServletResponse);
    } catch (Exception e) {
      e.printStackTrace();
      throw new WebApplicationException(e);
    }
  }