private void parse(Concept c) throws IOException, ParseException {
   write(c);
   if (c.getDescription() != null) {
     for (Description d : c.getDescription()) {
       write(d);
     }
   }
 }
 @Override
 public boolean equals(Object o) {
   if (o instanceof Concept) {
     Concept c = (Concept) o;
     if (c.getSerialisedId() == this.getSerialisedId()) {
       return true;
     }
   }
   return false;
 }
 public XmlRefsetConcept(Concept c) {
   setId(c.getSerialisedId());
   setTitle(c.getFullySpecifiedName());
   setEffectiveTime(c.getEffectiveTime());
   setActive(c.isActive());
   try {
     setHref(UrlBuilder.createConceptUrl(c));
   } catch (MalformedURLException e) {
     LOG.error("Unable to build concept href url, setting null: " + e.getMessage(), e);
     setHref(null);
   }
 }
  @Override
  public void write(final Concept c) throws IOException, ParseException {
    final String id = NS_SNOMED_CONCEPT_IDENTIFIER + ':' + c.getSerialisedId();

    // Master
    writeDatatypeProperties(c, id);

    // Description
    if ((c.getDescription() != null) && !c.getDescription().isEmpty()) {
      for (Description d : c.getDescription()) {
        writer.write(
            id
                + ' '
                + PROPERTY_SNOMED_DESCRIPTION
                + ' '
                + NS_SNOMED_DESCRIPTION_IDENTIFIER
                + ':'
                + d.getSerialisedId()
                + LINE_ENDING);
      }
    }

    // History
    if ((c.getHistory() != null) && !c.getHistory().isEmpty()) {
      int counter = 1;
      for (Concept hc : c.getHistory()) {
        String hid = id + "_h" + counter++;

        writeDatatypeProperties(hc, hid);

        // History Entry
        writer.write(id + ' ' + PROPERTY_SNOMED_HISTORY_ENTRY + ' ' + hid + LINE_ENDING);
      }
    }
  }
  public void writeDatatypeProperties(final Concept c, String id)
      throws IOException, ParseException {
    // Label
    writer.write(
        id
            + ' '
            + PROPERTY_RDFS_LABEL
            + " \""
            + safe(c.getFullySpecifiedName())
            + '\"'
            + LANGUAGE
            + LINE_ENDING);

    // Active
    writer.write(
        id
            + ' '
            + PROPERTY_SNOMED_ACTIVE
            + " \""
            + (c.isActive() == true ? "true" : "false")
            + '\"'
            + XML_SCHEMA_DATATYPE_BOOLEAN
            + LINE_ENDING);

    // Module
    if (c.getModule() != null) {
      writer.write(
          id
              + ' '
              + PROPERTY_SNOMED_MODULE
              + ' '
              + NS_SNOMED_CONCEPT_IDENTIFIER
              + ':'
              + c.getModule().getSerialisedId()
              + LINE_ENDING);
    }

    // Status
    if (c.getStatus() != null) {
      writer.write(
          id
              + ' '
              + PROPERTY_SNOMED_STATUS
              + ' '
              + NS_SNOMED_CONCEPT_IDENTIFIER
              + ':'
              + c.getStatus().getSerialisedId()
              + LINE_ENDING);
    }

    // Effective Time
    writer.write(
        id
            + ' '
            + PROPERTY_SNOMED_EFFECTIVE_TIME
            + " \""
            + dateTimeFormatter.format(longTimeParser.parse(String.valueOf(c.getEffectiveTime())))
            + '\"'
            + XML_SCHEMA_DATATYPE_DATE
            + LINE_ENDING);
  }