Search in sources :

Example 11 with SKOSRelation

use of skos.SKOSRelation in project opentheso by miledrousset.

the class SkosToJsonldSchemaOrg method addRelations.

private void addRelations(ArrayList<SKOSRelation> relations) {
    ArrayList<SKOSRelation> narrower = new ArrayList<>();
    ArrayList<SKOSRelation> related = new ArrayList<>();
    ArrayList<SKOSRelation> broader = new ArrayList<>();
    ArrayList<SKOSRelation> inScheme = new ArrayList<>();
    for (SKOSRelation relation : relations) {
        switch(relation.getProperty()) {
            case SKOSProperty.broader:
                broader.add(relation);
                break;
            case SKOSProperty.narrower:
                narrower.add(relation);
                break;
            case SKOSProperty.related:
                related.add(relation);
                break;
            case SKOSProperty.ConceptScheme:
                inScheme.add(relation);
                break;
            default:
                break;
        }
    }
    // broader
    if (!broader.isEmpty()) {
        addElementRelation(broader, "broader");
    }
    // narrower
    if (!narrower.isEmpty()) {
        addElementRelation(narrower, "narrower");
    }
    // related
    if (!related.isEmpty()) {
        addElementRelation(related, "related");
    }
    // ConceptScheme
    if (!inScheme.isEmpty()) {
        addElementRelation(inScheme, "inScheme");
    }
}
Also used : ArrayList(java.util.ArrayList) SKOSRelation(skos.SKOSRelation)

Aggregations

SKOSRelation (skos.SKOSRelation)11 Connection (java.sql.Connection)5 SQLException (java.sql.SQLException)5 HierarchicalRelationship (mom.trd.opentheso.bdd.datas.HierarchicalRelationship)5 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)5 ArrayList (java.util.ArrayList)2 ConceptGroupLabel (mom.trd.opentheso.bdd.datas.ConceptGroupLabel)1 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)1 StringPlus (mom.trd.opentheso.bdd.tools.StringPlus)1 SKOSResource (skos.SKOSResource)1