public boolean hasStereotype(Element element, String stereotypeName) { return element.getAppliedStereotype(stereotypeName) != null; } public List<Object> getTaggedValue(Element element, String stereotypeName, String property) { Stereotype stereotype = element.getAppliedStereotype(stereotypeName); List<Object> result = new ArrayList<Object>(); if (stereotype == null) { return result; } Object value = element.getValue(stereotype, property); if (value instanceof Collection) { result.addAll((Collection)value); } else { result.add(value); } return result; }
[ aPort.hasStereotype('SysML::PortAndFlows::FlowPort')/]
[aPort.hasStereotype('FlowPort')/]
[aPort.getStereotypeValue('SysML::PortAndFlows::FlowPort', 'direction')/]
[aPort.hasStereotype('FlowPort')/]
[aPort.hasStereotype('SysML::PortAndFlows::FlowPort')/]
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap(); // UML2 profiles URI uri = URI.createURI("platform:/plugin/org.eclipse.uml2.uml.resources"); uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment("")); uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment("")); uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment("")); // SysML profiles uri = URI.createURI("platform:/plugin/org.eclipse.papyrus.sysml"); uriMap.put(URI.createURI(SysmlResource.LIBRARIES_PATHMAP), uri.appendSegment("librairies").appendSegment("")); uriMap.put(URI.createURI("pathmap://SysML_PROFILES/"), uri.appendSegment("model").appendSegment(""));