コード例 #1
0
  /** {@inheritDoc} */
  @Override
  public Dialect createCustomDialect(
      KamInfo kamInfo,
      List<Namespace> geneNamespaces,
      List<Namespace> bpNamespaces,
      List<Namespace> chemicalNamespaces,
      BELSyntax form,
      boolean removeNamespacePrefix)
      throws KamStoreException {

    // cache all namespaces of the kam by prefix
    Map<String, Namespace> kamNamespaces = new HashMap<String, Namespace>();
    Map<String, NamespaceDomain> domains = new HashMap<String, NamespaceDomain>();
    for (org.openbel.framework.internal.KAMStoreDaoImpl.Namespace ns :
        kamStore.getNamespaces(kamInfo)) {
      Namespace cns = new Namespace(ns.getPrefix(), ns.getResourceLocation());
      kamNamespaces.put(cns.getPrefix(), cns);
      NamespaceHeader hdr = namespaceResourceService.getHeader(cns.getResourceLocation());
      domains.put(
          cns.getPrefix(),
          NamespaceDomain.forDomainString(hdr.getNamespaceBlock().getDomainString()));
    }

    CustomDialect pd = new CustomDialect(kamStore);
    pd.setKamNamespaces(kamNamespaces);
    pd.setNsDomains(domains);
    pd.setGeneNamespaces(geneNamespaces);
    pd.setBpNamespaces(bpNamespaces);
    pd.setChemNamespaces(chemicalNamespaces);
    if (BELSyntax.LONG_FORM.equals(form)) {
      pd.setDisplayLongForm(true);
    }
    pd.setRemoveNamespacePrefix(removeNamespacePrefix);

    pd.initialize();
    return pd;
  }
コード例 #2
0
 static {
   for (NamespaceDomain nd : values()) {
     DSMAP.put(nd.getDomainString(), nd);
   }
 }