How to use findConceptsWithSynonymMatching method
Last Post 24 Sep 2014 03:03 PM by jbowie. 1 Replies.
Author Messages
albagjimenezUser is Offline
New Member
New Member
Posts:47


--
24 Sep 2014 11:25 AM
    Hi, I'm testing the Apelon DTS WS.

    I'd like to get all the synonyms concepts from the "Body structure (body structure)" in SNOMED namespace.

    This is my code:


    ...

    /**
    * Sample code using a JAX-WS client.
    */
    public class Example {
    public static void main(String[] args) {
    try {
    // Instantiate client
    DtsQueryDaoService service = new DtsQueryDaoService();
    System.out.println("Retrieving the port from the following service: " + service);
    DtsQueryDaoWS port = service.getDtsQueryDaoPort();
    // Set credentials for JAX-WS.
    Map<String, Object> requestContext = ((BindingProvider) port).getRequestContext();
    requestContext.put(BindingProvider.USERNAME_PROPERTY, "dtsadminuser");
    requestContext.put(BindingProvider.PASSWORD_PROPERTY, "dtsadmin");

    // String conceptCode = "C3"; // Medication in OpenCDS namespace
    //int namespaceId = 32769; // OpenCDS


    // Configure the service to read all property types
    TConceptAttributeSetDescriptor attributeSetDescriptor = new TConceptAttributeSetDescriptor();
    attributeSetDescriptor.setAllPropertyTypes(true);
    System.out.println("Invoking the findConceptsWithSynonymMatching operation on the port.");

    //Association Type
    TAssociationType associationType = new TAssociationType();
    associationType.setName("English Synonym");
    int namespaceId = 32770; //SNOMED CT
    associationType.setNamespaceId(namespaceId);
    associationType.setItemsConnected(TItemsConnected.S);

    //Search pattern
    String searchPattern = "Body structure (body structure)";

    //Options
    TConceptSearchOptions options = new TConceptSearchOptions();
    options.setLimit(10);

    List<TOntylogConcept> concepts = port.findConceptsWithSynonymMatching(associationType, searchPattern, options);
    for (TOntylogConcept concept : concepts) {
    // Print some concept info
    String conceptName = concept.getName();
    System.out.println("Concept Name: " + conceptName);
    System.out.println();
    // Print concept properties
    List<TProperty> props = concept.getProperties();
    System.out.println("Properties\n==========");
    for (TProperty prop : props) {
    System.out.println(prop.getPropertyType().getName() + ": "
    + prop.getValue());
    }
    }
    } catch (Exception ex) {
    ex.printStackTrace();
    }
    }
    }



    But I'm getting this error:


    Retrieving the port from the following service: com.apelon.dtsserver.ws.dtsquery.DtsQueryDaoService@4611a2cb
    sep 24, 2014 6:19:15 PM org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
    Información: Creating Service {http://apelon.com/dtsserver/ws/dtsquery}DtsQueryDaoService from WSDL: http://localhost:28080/soap/DtsQueryDaoWS?wsdl
    Invoking the findConceptsWithSynonymMatching operation on the port.
    javax.xml.ws.soap.SOAPFaultException: Cannot find GID. DTS Object is missing ID or Namespace ID
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:159)
    at com.sun.proxy.$Proxy40.findConceptsWithSynonymMatching(Unknown Source)
    at sspa.huvr.git.Example.main(Example.java:74)
    Caused by: org.apache.cxf.binding.soap.SoapFault: Cannot find GID. DTS Object is missing ID or Namespace ID
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51)
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1636)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1525)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:137)
    ... 2 more


    What can I be doing wrong?

    Thanks in advance!
    jbowieUser is Offline
    Basic Member
    Basic Member
    Posts:110


    --
    24 Sep 2014 03:03 PM
    When passing an attribute type, like association type, into one of the methods, the object needs to be a validated object from the db. Use:

    associationType = port.findAssociationTypeByName(name, nsid);

    to fetch the correct type.
    Similar methods are available for other attribute types.


    ---