コード例 #1
0
ファイル: Turtle.java プロジェクト: xgfd/SSBLD
  /*
   * Converts the Person Object into an TriG String
   * representation.
   */
  private String convertPerson(Person person, ObjectBundle bundle) {
    StringBuffer result = new StringBuffer();
    // First the uriref for the subject

    result.append(Person.getPrefixed(person.getNr(), bundle.getPublisherNum()));
    result.append("\n");

    // rdf:type
    result.append(createTriplePO(RDF.prefixed("type"), FOAF.prefixed("Person")));

    // foaf:name
    result.append(createTriplePO(FOAF.prefixed("name"), createLiteral(person.getName())));

    // foaf:mbox_sha1sum
    result.append(
        createTriplePO(FOAF.prefixed("mbox_sha1sum"), createLiteral(person.getMbox_sha1sum())));

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

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

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

    return result.toString();
  }
コード例 #2
0
ファイル: Turtle.java プロジェクト: xgfd/SSBLD
  /*
   * Converts the Vendor Object into an TriG String
   * representation.
   */
  private String convertVendor(Vendor vendor) {
    StringBuffer result = new StringBuffer();
    // First the uriref for the subject

    result.append(Vendor.getPrefixed(vendor.getNr()));
    result.append("\n");

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

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

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

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

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

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

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

    return result.toString();
  }