Exemplo n.º 1
0
  /*
   * Converts the Producer Object into an TriG String
   * representation.
   */
  private String convertProducer(Producer producer) {
    StringBuffer result = new StringBuffer();
    // First the uriref for the subject

    result.append(Producer.getPrefixed(producer.getNr()));
    result.append("\n");

    // rdf:type
    result.append(createTriplePO(RDF.prefixed("type"), BSBM.prefixed("Producer")));

    // rdfs:label
    result.append(createTriplePO(RDFS.prefixed("label"), createLiteral(producer.getLabel())));

    // rdfs:comment
    result.append(createTriplePO(RDFS.prefixed("comment"), createLiteral(producer.getComment())));

    // foaf:homepage
    result.append(createTriplePO(FOAF.prefixed("homepage"), createURIref(producer.getHomepage())));

    // bsbm:country
    result.append(
        createTriplePO(
            BSBM.prefixed("country"), createURIref(ISO3166.find(producer.getCountryCode()))));

    // dc:publisher
    result.append(
        createTriplePO(DC.prefixed("publisher"), Producer.getPrefixed(producer.getPublisher())));

    // dc:date
    GregorianCalendar date = new GregorianCalendar();
    date.setTimeInMillis(producer.getPublishDate());
    String dateString = DateGenerator.formatDate(date);
    result.append(
        createTriplePOEnd(
            DC.prefixed("date"), createDataTypeLiteral(dateString, XSD.prefixed("date"))));

    return result.toString();
  }