Search in sources :

Example 1 with NodeLang

use of mom.trd.opentheso.bdd.helper.nodes.NodeLang in project opentheso by miledrousset.

the class ExportRdf4jHelper method addThesaurus.

public void addThesaurus(String idThesaurus, List<NodeLang> selectedLanguages) {
    nodeThesaurus = new ThesaurusHelper().getNodeThesaurus(ds, idThesaurus);
    String uri = getUriFromId(nodeThesaurus.getIdThesaurus());
    SKOSResource conceptScheme = new SKOSResource(uri, SKOSProperty.ConceptScheme);
    idTheso = nodeThesaurus.getIdThesaurus();
    String creator;
    String contributor;
    String title;
    String language;
    for (Thesaurus thesaurus : nodeThesaurus.getListThesaurusTraduction()) {
        boolean isInSelectedLanguages = false;
        for (NodeLang nodeLang : selectedLanguages) {
            if (nodeLang.getCode().equals(thesaurus.getLanguage())) {
                isInSelectedLanguages = true;
                break;
            }
        }
        if (!isInSelectedLanguages) {
            break;
        }
        creator = thesaurus.getCreator();
        contributor = thesaurus.getContributor();
        title = thesaurus.getTitle();
        language = thesaurus.getLanguage();
        /*[...]*/
        if (creator != null && !creator.equalsIgnoreCase("null")) {
            conceptScheme.addCreator(creator, SKOSProperty.creator);
        }
        if (contributor != null && !contributor.equalsIgnoreCase("null")) {
            conceptScheme.addCreator(creator, SKOSProperty.contributor);
        }
        if (title != null && language != null) {
            conceptScheme.addLabel(title, language, SKOSProperty.prefLabel);
        }
        // dates
        String created = thesaurus.getCreated().toString();
        String modified = thesaurus.getModified().toString();
        if (created != null) {
            conceptScheme.addDate(created, SKOSProperty.created);
        }
        if (modified != null) {
            conceptScheme.addDate(modified, SKOSProperty.modified);
        }
    }
    skosXmlDocument.setConceptScheme(conceptScheme);
}
Also used : SKOSResource(mom.trd.opentheso.skosapi.SKOSResource) Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) NodeThesaurus(mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang)

Example 2 with NodeLang

use of mom.trd.opentheso.bdd.helper.nodes.NodeLang in project opentheso by miledrousset.

the class ExportRdf4jHelper method addNoteGiven.

private void addNoteGiven(ArrayList<NodeNote> nodeNotes, SKOSResource resource, List<NodeLang> selectedLanguages) {
    for (NodeNote note : nodeNotes) {
        boolean isInselectedLanguages = false;
        for (NodeLang nodeLang : selectedLanguages) {
            if (nodeLang.getCode().equals(note.getLang())) {
                isInselectedLanguages = true;
                break;
            }
        }
        if (!isInselectedLanguages) {
            continue;
        }
        int prop;
        switch(note.getNotetypecode()) {
            case "scopeNote":
                prop = SKOSProperty.scopeNote;
                break;
            case "historyNote":
                prop = SKOSProperty.historyNote;
                break;
            case "definition":
                prop = SKOSProperty.definition;
                break;
            case "editorialNote":
                prop = SKOSProperty.editorialNote;
                break;
            default:
                prop = SKOSProperty.note;
                break;
        }
        resource.addDocumentation(note.getLexicalvalue(), note.getLang(), prop);
    }
}
Also used : NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang) NodeNote(mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)

Example 3 with NodeLang

use of mom.trd.opentheso.bdd.helper.nodes.NodeLang in project opentheso by miledrousset.

the class GpsQuery method queryGps2.

public ArrayList<NodeAlignment> queryGps2(String idC, String idTheso, String lexicalValue, String lang, String requete) {
    ArrayList<NodeLang> nodeLangs;
    try {
        lexicalValue = URLEncoder.encode(lexicalValue, "UTF-8");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(GpsQuery.class.getName()).log(Level.SEVERE, null, ex);
    }
    lexicalValue = lexicalValue.replaceAll(" ", "%20");
    requete = requete.replace("##lang##", lang);
    requete = requete.replace("##value##", lexicalValue);
    try {
        // URL url = new URL("https://" + lang + ".wikipedia.org/w/api.php?action=query&list=search&srwhat=text&format=xml&srsearch=" + lexicalValue + "&srnamespace=0");
        // requete = URLEncoder.encode(requete, "UTF-8");
        URL url = new URL(requete);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("Accept", "application/xml");
        if (conn.getResponseCode() != 200) {
            throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
        }
        BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
        String output;
        String xmlRecord = "";
        while ((output = br.readLine()) != null) {
            xmlRecord += output;
        }
        byte[] bytes = xmlRecord.getBytes();
        xmlRecord = new String(bytes, Charset.forName("UTF-8"));
        conn.disconnect();
        try {
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            InputSource is = new InputSource();
            is.setCharacterStream(new StringReader(xmlRecord));
            org.w3c.dom.Document doc = db.parse(is);
            NodeList nodes = doc.getElementsByTagName("geoname");
            listeAlign = new ArrayList<>();
            // iterate the employees
            for (int i = 0; i < nodes.getLength(); i++) {
                nodeLangs = new ArrayList<>();
                org.w3c.dom.Element element = (org.w3c.dom.Element) nodes.item(i);
                NodeAlignment nodeAlignment = new NodeAlignment();
                NodeList nodeList = element.getElementsByTagName("name");
                for (int j = 0; j < nodeList.getLength(); j++) {
                    nodeAlignment.setName(nodeList.item(j).getTextContent());
                }
                nodeList = element.getElementsByTagName("lat");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        nodeAlignment.setLat(Double.parseDouble(nodeList.item(j).getTextContent()));
                    }
                }
                nodeList = element.getElementsByTagName("lng");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        nodeAlignment.setLng(Double.parseDouble(nodeList.item(j).getTextContent()));
                    }
                }
                nodeList = element.getElementsByTagName("geonameId");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        nodeAlignment.setIdUrl("http://www.geonames.org/" + (nodeList.item(j).getTextContent()));
                    }
                }
                nodeList = element.getElementsByTagName("countryName");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        nodeAlignment.setCountryName(nodeList.item(j).getTextContent());
                    }
                }
                nodeList = element.getElementsByTagName("toponymName");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        nodeAlignment.setToponymName(nodeList.item(j).getTextContent());
                    }
                }
                nodeList = element.getElementsByTagName("adminName1");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        nodeAlignment.setAdminName1(nodeList.item(j).getTextContent());
                    }
                }
                nodeList = element.getElementsByTagName("adminName2");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        nodeAlignment.setAdminName2(nodeList.item(j).getTextContent());
                    }
                }
                nodeList = element.getElementsByTagName("alternateName");
                if (nodeList != null && nodeList.getLength() > 0) {
                    for (int j = 0; j < nodeList.getLength(); j++) {
                        NodeLang nodeLang = new NodeLang();
                        // nodeAlignment.setToponymName(p.item(j).getTextContent());
                        ArrayList<String> langueFound = new ArrayList<>();
                        org.w3c.dom.Element el = (org.w3c.dom.Element) nodeList.item(j);
                        if (el.hasAttribute("lang")) {
                            nodeLang.setCode(el.getAttribute("lang"));
                            nodeLang.setValue(nodeList.item(j).getTextContent());
                        }
                        nodeLangs.add(nodeLang);
                    }
                    nodeAlignment.setAlltraductions(nodeLangs);
                }
                listeAlign.add(nodeAlignment);
            }
        } catch (ParserConfigurationException | SAXException | IOException e) {
        }
    } catch (MalformedURLException e) {
    } catch (IOException e) {
    }
    return listeAlign;
}
Also used : InputSource(org.xml.sax.InputSource) MalformedURLException(java.net.MalformedURLException) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Element(org.jdom2.Element) ArrayList(java.util.ArrayList) URL(java.net.URL) SAXException(org.xml.sax.SAXException) HttpURLConnection(java.net.HttpURLConnection) StringReader(java.io.StringReader) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) InputStreamReader(java.io.InputStreamReader) NodeList(org.w3c.dom.NodeList) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) DocumentBuilder(javax.xml.parsers.DocumentBuilder) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang) BufferedReader(java.io.BufferedReader)

Example 4 with NodeLang

use of mom.trd.opentheso.bdd.helper.nodes.NodeLang in project opentheso by miledrousset.

the class ExportTabulateHelper method writeConcepts.

private boolean writeConcepts() {
    ArrayList<NodeConceptExport> nodeConceptExports = thesaurusDatas.getNodeConceptExports();
    boolean first = true;
    ArrayList<NodeNote> nodeNoteDefinition = new ArrayList<>();
    ArrayList<NodeNote> nodeNoteScope = new ArrayList<>();
    ArrayList<NodeNote> nodeNoteHistory = new ArrayList<>();
    ArrayList<NodeNote> nodeNoteEditorial = new ArrayList<>();
    ArrayList<String> listLangues = new ArrayList<>();
    for (NodeLang selectedLanguage : selectedLanguages) {
        listLangues.add(selectedLanguage.getCode());
    }
    for (NodeConceptExport nodeConceptExport : nodeConceptExports) {
        nodeNoteDefinition.clear();
        nodeNoteScope.clear();
        nodeNoteHistory.clear();
        nodeNoteEditorial.clear();
        // id
        tabulateBuff.append(nodeConceptExport.getConcept().getIdConcept());
        tabulateBuff.append(";");
        // idArk
        if (nodeConceptExport.getConcept().getIdArk() == null) {
            tabulateBuff.append("");
        } else {
            tabulateBuff.append(nodeConceptExport.getConcept().getIdArk());
        }
        tabulateBuff.append(";");
        // type
        if (nodeConceptExport.getConcept().isTopConcept()) {
            tabulateBuff.append("TT");
        } else {
            tabulateBuff.append("DE");
        }
        tabulateBuff.append(";");
        // preflabel
        for (NodeTermTraduction nodeTermTraduction : nodeConceptExport.getNodeTermTraductions()) {
            if (listLangues.contains(nodeTermTraduction.getLang())) {
                if (!first) {
                    tabulateBuff.append("##");
                }
                tabulateBuff.append(nodeTermTraduction.getLexicalValue());
                tabulateBuff.append("::");
                tabulateBuff.append(nodeTermTraduction.getLang());
                first = false;
            }
        }
        tabulateBuff.append(";");
        // altLabel
        first = true;
        for (NodeEM nodeEM : nodeConceptExport.getNodeEM()) {
            if (listLangues.contains(nodeEM.getLang())) {
                if (!first) {
                    tabulateBuff.append("##");
                }
                tabulateBuff.append(nodeEM.getLexical_value());
                tabulateBuff.append("::");
                tabulateBuff.append(nodeEM.getLang());
                first = false;
            }
        }
        tabulateBuff.append(";");
        // inScheme
        first = true;
        for (NodeUri nodeUri : nodeConceptExport.getNodeListIdsOfConceptGroup()) {
            if (!first) {
                tabulateBuff.append("##");
            }
            tabulateBuff.append(nodeUri.getIdConcept());
            first = false;
        }
        tabulateBuff.append(";");
        // broader
        first = true;
        for (NodeHieraRelation node : nodeConceptExport.getNodeListOfBT()) {
            if (!first) {
                tabulateBuff.append("##");
            }
            tabulateBuff.append(node.getUri().getIdConcept());
            first = false;
        }
        tabulateBuff.append(";");
        // narrower
        first = true;
        for (NodeHieraRelation node : nodeConceptExport.getNodeListOfNT()) {
            if (!first) {
                tabulateBuff.append("##");
            }
            tabulateBuff.append(node.getUri().getIdConcept());
            first = false;
        }
        tabulateBuff.append(";");
        // related
        first = true;
        for (NodeHieraRelation nodeUri : nodeConceptExport.getNodeListIdsOfRT()) {
            if (!first) {
                tabulateBuff.append("##");
            }
            tabulateBuff.append(nodeUri.getUri().getIdConcept());
            first = false;
        }
        tabulateBuff.append(";");
        // alignment
        first = true;
        for (NodeAlignment nodeAlignment : nodeConceptExport.getNodeAlignmentsList()) {
            if (!first) {
                tabulateBuff.append("##");
            }
            if (nodeAlignment.getAlignement_id_type() == 1) {
                tabulateBuff.append("exactMatch::");
                tabulateBuff.append(nodeAlignment.getUri_target());
            }
            if (nodeAlignment.getAlignement_id_type() == 2) {
                tabulateBuff.append("closeMatch::");
                tabulateBuff.append(nodeAlignment.getUri_target());
            }
            first = false;
        }
        tabulateBuff.append(";");
        // types : definition; editorialNote; historyNote ; scopeNote
        for (NodeNote nodeNote : nodeConceptExport.getNodeNoteConcept()) {
            nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\r', ' '));
            nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\n', ' '));
            if (nodeNote.getNotetypecode().equalsIgnoreCase("definition")) {
                nodeNoteDefinition.add(nodeNote);
            }
            if (nodeNote.getNotetypecode().equalsIgnoreCase("editorialNote")) {
                nodeNoteEditorial.add(nodeNote);
            }
            if (nodeNote.getNotetypecode().equalsIgnoreCase("historyNote")) {
                nodeNoteHistory.add(nodeNote);
            }
            if (nodeNote.getNotetypecode().equalsIgnoreCase("scopeNote")) {
                nodeNoteScope.add(nodeNote);
            }
        }
        // types : definition; editorialNote; historyNote ; scopeNote
        for (NodeNote nodeNote : nodeConceptExport.getNodeNoteTerm()) {
            nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\r', ' '));
            nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\n', ' '));
            if (nodeNote.getNotetypecode().equalsIgnoreCase("definition")) {
                nodeNoteDefinition.add(nodeNote);
            }
            if (nodeNote.getNotetypecode().equalsIgnoreCase("editorialNote")) {
                nodeNoteEditorial.add(nodeNote);
            }
            if (nodeNote.getNotetypecode().equalsIgnoreCase("historyNote")) {
                nodeNoteHistory.add(nodeNote);
            }
            if (nodeNote.getNotetypecode().equalsIgnoreCase("scopeNote")) {
                nodeNoteScope.add(nodeNote);
            }
        }
        // definition
        first = true;
        for (NodeNote nodeNote : nodeNoteDefinition) {
            if (listLangues.contains(nodeNote.getLang())) {
                if (!first) {
                    tabulateBuff.append("##");
                }
                tabulateBuff.append(nodeNote.getLexicalvalue());
                tabulateBuff.append("::");
                tabulateBuff.append(nodeNote.getLang());
                first = false;
            }
        }
        tabulateBuff.append(";");
        // scopeNote
        first = true;
        for (NodeNote nodeNote : nodeNoteScope) {
            if (listLangues.contains(nodeNote.getLang())) {
                if (!first) {
                    tabulateBuff.append("##");
                }
                tabulateBuff.append(nodeNote.getLexicalvalue());
                tabulateBuff.append("::");
                tabulateBuff.append(nodeNote.getLang());
                first = false;
            }
        }
        tabulateBuff.append(";");
        // historyNote
        first = true;
        for (NodeNote nodeNote : nodeNoteHistory) {
            if (listLangues.contains(nodeNote.getLang())) {
                if (!first) {
                    tabulateBuff.append("##");
                }
                tabulateBuff.append(nodeNote.getLexicalvalue());
                tabulateBuff.append("::");
                tabulateBuff.append(nodeNote.getLang());
                first = false;
            }
        }
        tabulateBuff.append(";");
        // editorialNote
        first = true;
        for (NodeNote nodeNote : nodeNoteEditorial) {
            if (listLangues.contains(nodeNote.getLang())) {
                if (!first) {
                    tabulateBuff.append("##");
                }
                tabulateBuff.append(nodeNote.getLexicalvalue());
                tabulateBuff.append("::");
                tabulateBuff.append(nodeNote.getLang());
                first = false;
            }
        }
        tabulateBuff.append(";");
        // dates
        tabulateBuff.append(nodeConceptExport.getConcept().getCreated());
        tabulateBuff.append(";");
        tabulateBuff.append(nodeConceptExport.getConcept().getModified());
        tabulateBuff.append("\n");
        first = true;
    }
    return true;
}
Also used : NodeConceptExport(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport) ArrayList(java.util.ArrayList) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) NodeTermTraduction(mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction) NodeEM(mom.trd.opentheso.bdd.helper.nodes.NodeEM) NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) NodeHieraRelation(mom.trd.opentheso.bdd.helper.nodes.NodeHieraRelation) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang) NodeNote(mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)

Example 5 with NodeLang

use of mom.trd.opentheso.bdd.helper.nodes.NodeLang in project opentheso by miledrousset.

the class WriteFileSKOS method writeDescriptor.

/**
 * Cette fonction permet d'exporter un Concept au format SKOS, Si
 * l'identifiant Ark existe, on l'exporte comme URI, sinon, on utilise
 * l'adresse URI du Site par defaut.
 *
 * @param nodeConceptExport
 * @param selectedLanguages
 *
 * @return true ou false
 */
public boolean writeDescriptor(NodeConceptExport nodeConceptExport, List<NodeLang> selectedLanguages) {
    /*
        // test pour savoir si le concept n'a pas de PrefLabel dans cette langue, il sera ignoré
        boolean havePrefLabel = false;
        if(selectedLanguages != null) {
            for (int i = 0; i < nodeConceptExport.getNodeTermTraductions().size(); i++) {
                for (NodeLang selectedLanguage : selectedLanguages) {
                    if (nodeConceptExport.getNodeTermTraductions().get(i).getLang().equalsIgnoreCase(
                            selectedLanguage.getCode())) {
                        havePrefLabel = true;
                    }
                }
            }
            if(!havePrefLabel) return true; // on ignore le concept
        }*/
    SKOSResource concept = new SKOSResource(getUri(nodeConceptExport));
    if (nodeConceptExport == null) {
        return true;
    }
    if (nodeConceptExport.getNodeTermTraductions() == null) {
        return true;
    }
    for (int i = 0; i < nodeConceptExport.getNodeTermTraductions().size(); i++) {
        if (selectedLanguages != null) {
            // if(nodeConceptExport.getNodeTermTraductions().get(i).getLang().equalsIgnoreCase("fr"))
            for (NodeLang selectedLanguage : selectedLanguages) {
                if (nodeConceptExport.getNodeTermTraductions().get(i).getLang().equalsIgnoreCase(selectedLanguage.getCode())) {
                    concept.addLabel(nodeConceptExport.getNodeTermTraductions().get(i).getLexicalValue(), nodeConceptExport.getNodeTermTraductions().get(i).getLang(), SKOSProperty.prefLabel);
                }
            }
        } else {
            concept.addLabel(nodeConceptExport.getNodeTermTraductions().get(i).getLexicalValue(), nodeConceptExport.getNodeTermTraductions().get(i).getLang(), SKOSProperty.prefLabel);
        }
    }
    concept.addDate(nodeConceptExport.getConcept().getCreated().toString(), SKOSProperty.created);
    concept.addDate(nodeConceptExport.getConcept().getModified().toString(), SKOSProperty.modified);
    if (!nodeConceptExport.getConcept().getNotation().isEmpty()) {
        concept.addNotation(nodeConceptExport.getConcept().getNotation(), SKOSProperty.notation);
    }
    if (!nodeConceptExport.getConcept().getIdConcept().isEmpty()) {
        concept.addIdentifier(nodeConceptExport.getConcept().getIdConcept(), SKOSProperty.identifier);
    }
    for (int i = 0; i < nodeConceptExport.getNodeListIdsOfConceptGroup().size(); i++) {
        // concept.addRelation(URI + "/concept#" + nodeConceptExport.getNodeListIdsOfConceptGroup().get(i), SKOSProperty.inScheme);
        concept.addRelation(getRelationUri_inScheme(nodeConceptExport.getNodeListIdsOfConceptGroup().get(i), nodeConceptExport.getConcept().getIdThesaurus()), SKOSProperty.inScheme);
    }
    for (int i = 0; i < nodeConceptExport.getNodeListOfBT().size(); i++) {
        // concept.addRelation(URI + "/concept#" + nodeConceptExport.getNodeListIdsOfBT().get(i), SKOSProperty.broader);
        concept.addRelation(getRelationUri(nodeConceptExport.getNodeListOfBT().get(i).getUri(), nodeConceptExport.getConcept().getIdThesaurus()), SKOSProperty.broader);
    }
    for (int i = 0; i < nodeConceptExport.getNodeListOfNT().size(); i++) {
        // concept.addRelation(URI + "/concept#" + nodeConceptExport.getNodeListIdsOfNT().get(i), SKOSProperty.narrower);
        concept.addRelation(getRelationUri(nodeConceptExport.getNodeListOfNT().get(i).getUri(), nodeConceptExport.getConcept().getIdThesaurus()), SKOSProperty.narrower);
    }
    for (int i = 0; i < nodeConceptExport.getNodeListIdsOfRT().size(); i++) {
        // concept.addRelation(URI + "/concept#" + nodeConceptExport.getNodeListIdsOfRT().get(i), SKOSProperty.related);
        concept.addRelation(getRelationUri(nodeConceptExport.getNodeListIdsOfRT().get(i).getUri(), nodeConceptExport.getConcept().getIdThesaurus()), SKOSProperty.related);
    }
    for (int i = 0; i < nodeConceptExport.getNodeEM().size(); i++) {
        if (nodeConceptExport.getNodeEM().get(i).isHiden()) {
            concept.addLabel(nodeConceptExport.getNodeEM().get(i).getLexical_value(), nodeConceptExport.getNodeEM().get(i).getLang(), SKOSProperty.hiddenLabel);
        } else {
            concept.addLabel(nodeConceptExport.getNodeEM().get(i).getLexical_value(), nodeConceptExport.getNodeEM().get(i).getLang(), SKOSProperty.altLabel);
        }
    }
    for (NodeAlignment alignment : nodeConceptExport.getNodeAlignmentsList()) {
        // alignement exactMatch
        if (alignment.getAlignement_id_type() == 1) {
            concept.addMapping(prepareUriTohtml(alignment.getUri_target()), SKOSMapping.exactMatch);
        }
        // alignement closeMatch
        if (alignment.getAlignement_id_type() == 2) {
            concept.addMapping(prepareUriTohtml(alignment.getUri_target()), SKOSMapping.closeMatch);
        }
        // alignement broadMatch
        if (alignment.getAlignement_id_type() == 3) {
            concept.addMapping(prepareUriTohtml(alignment.getUri_target()), SKOSMapping.broadMatch);
        }
        // alignement relatedMatch
        if (alignment.getAlignement_id_type() == 4) {
            concept.addMapping(prepareUriTohtml(alignment.getUri_target()), SKOSMapping.relatedMatch);
        }
        // alignement narrowMatch
        if (alignment.getAlignement_id_type() == 5) {
            concept.addMapping(prepareUriTohtml(alignment.getUri_target()), SKOSMapping.narrowMatch);
        }
    }
    for (NodeNote nodeNote : nodeConceptExport.getNodeNoteTerm()) {
        if (nodeNote.getNotetypecode().equalsIgnoreCase("historyNote")) {
            concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.historyNote);
        }
        if (nodeNote.getNotetypecode().equalsIgnoreCase("editorialNote")) {
            concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.editorialNote);
        }
        if (nodeNote.getNotetypecode().equalsIgnoreCase("definition")) {
            concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.definition);
        }
    }
    for (NodeNote nodeNote : nodeConceptExport.getNodeNoteConcept()) {
        if (nodeNote.getNotetypecode().equalsIgnoreCase("note")) {
            concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.note);
        }
        if (nodeNote.getNotetypecode().equalsIgnoreCase("scopeNote")) {
            concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.scopeNote);
        }
    }
    if (nodeConceptExport.getNodeGps() != null) {
        concept.addSkosGps(nodeConceptExport.getNodeGps().getLatitude(), SKOSProperty.latitude);
        concept.addSkosGps(nodeConceptExport.getNodeGps().getLongitude(), SKOSProperty.longitude);
    }
    skosBuff.append("    ").append(concept.toString());
    return true;
}
Also used : NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) SKOSResource(skos.SKOSResource) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang) NodeNote(mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)

Aggregations

NodeLang (mom.trd.opentheso.bdd.helper.nodes.NodeLang)12 ArrayList (java.util.ArrayList)5 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)4 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)3 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)3 NodeUri (mom.trd.opentheso.bdd.helper.nodes.NodeUri)3 Languages_iso639 (mom.trd.opentheso.bdd.datas.Languages_iso639)2 LanguageHelper (mom.trd.opentheso.bdd.helper.LanguageHelper)2 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)2 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)2 NodeConceptExport (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport)2 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)2 NodeTermTraduction (mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction)2 SKOSResource (skos.SKOSResource)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 StringReader (java.io.StringReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 HttpURLConnection (java.net.HttpURLConnection)1