Search in sources :

Example 11 with Literal

use of org.eclipse.rdf4j.model.Literal in project opentheso by miledrousset.

the class WriteRdf4j method writeDocumentation.

private void writeDocumentation(SKOSResource resource) {
    int prop;
    for (SKOSDocumentation doc : resource.getDocumentationsList()) {
        prop = doc.getProperty();
        Literal literal = vf.createLiteral(doc.getText(), doc.getLanguage());
        switch(prop) {
            case SKOSProperty.definition:
                builder.add(SKOS.DEFINITION, literal);
                break;
            case SKOSProperty.scopeNote:
                builder.add(SKOS.SCOPE_NOTE, literal);
                break;
            case SKOSProperty.example:
                builder.add(SKOS.EXAMPLE, literal);
                break;
            case SKOSProperty.historyNote:
                builder.add(SKOS.HISTORY_NOTE, literal);
                break;
            case SKOSProperty.editorialNote:
                builder.add(SKOS.EDITORIAL_NOTE, literal);
                break;
            case SKOSProperty.changeNote:
                builder.add(SKOS.CHANGE_NOTE, literal);
                break;
            case SKOSProperty.note:
                builder.add(SKOS.NOTE, literal);
                break;
            default:
                break;
        }
    }
}
Also used : SKOSDocumentation(mom.trd.opentheso.skosapi.SKOSDocumentation) Literal(org.eclipse.rdf4j.model.Literal)

Aggregations

Literal (org.eclipse.rdf4j.model.Literal)11 Statement (org.eclipse.rdf4j.model.Statement)7 Model (org.eclipse.rdf4j.model.Model)6 Value (org.eclipse.rdf4j.model.Value)5 IRI (org.eclipse.rdf4j.model.IRI)4 ModelBuilder (org.eclipse.rdf4j.model.util.ModelBuilder)4 Test (org.junit.Test)4 ValueFactory (org.eclipse.rdf4j.model.ValueFactory)3 SimpleValueFactory (org.eclipse.rdf4j.model.impl.SimpleValueFactory)3 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Date (java.util.Date)2 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 RDFParseException (org.eclipse.rdf4j.rio.RDFParseException)2 JsonLdOptions (com.github.jsonldjava.core.JsonLdOptions)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 ArrayList (java.util.ArrayList)1