List of usage examples for org.jdom2 Element getTextTrim
public String getTextTrim()
From source file:agendavital.modelo.data.InicializarBD.java
public static void cargarXMLS() throws JDOMException, IOException, SQLException, ConexionBDIncorrecta { SAXBuilder builder = new SAXBuilder(); File xmlFolder = new File("Noticias"); File[] xmlFile = xmlFolder.listFiles(); System.out.println("LONGITUD " + xmlFile.length); for (int i = 0; i < xmlFile.length; i++) { Document document = (Document) builder.build(xmlFile[i]); Element rootNode = document.getRootElement(); List list = rootNode.getChildren("Noticia"); for (Object list1 : list) { Element noticia = (Element) list1; List noticiaCampos = noticia.getChildren(); String titulo = noticia.getChildTextTrim("titulo"); String fecha = noticia.getChildTextTrim("fecha"); String link = noticia.getChildTextTrim("link"); String categorias = noticia.getChildTextTrim("categoria"); String cuerpo = noticia.getChildTextTrim("cuerpo"); List tags = noticia.getChildren("tag"); ArrayList<String> etiquetas = new ArrayList<>(); for (Object tags1 : tags) { Element tag = (Element) tags1; etiquetas.add(tag.getTextTrim()); }/* w ww.ja v a2 s . c o m*/ Noticia.Insert(titulo, link, fecha, categorias, cuerpo, etiquetas); } } }
From source file:ca.nrc.cadc.caom2.xml.ArtifactAccessReader.java
License:Open Source License
private void getGroupList(List<URI> fill, String ename, List<Element> elements) { if (elements == null || elements.isEmpty()) { return;//from w w w .j av a2s . c om } if (elements.size() > 1) { throw new IllegalArgumentException( "invalid input document: found multiple " + ename + " expected: 0 or 1"); } Element ge = elements.get(0); for (Element e : ge.getChildren()) { if (!ENAMES.uri.name().equals(e.getName())) { throw new IllegalArgumentException( "invalid child element in " + ename + ": " + e.getName() + " expected: uri"); } URI guri = getURI(e.getTextTrim(), true); fill.add(guri); } }
From source file:ca.nrc.cadc.caom2.xml.ObservationReader.java
License:Open Source License
protected Polarization getPolarization(Element parent, Namespace namespace, ReadContext rc) throws ObservationParsingException { Element element = getChildElement("polarization", parent, namespace, false); if (element == null) { return null; }//from ww w.ja v a 2s . c o m Polarization pol = new Polarization(); Element cur = getChildElement("states", element, namespace, false); if (cur != null) { List<Element> ces = cur.getChildren(); pol.states = new ArrayList<PolarizationState>(ces.size()); for (Element e : ces) { String ss = e.getTextTrim(); PolarizationState ps = PolarizationState.valueOf(ss); pol.states.add(ps); } } cur = getChildElement("dimension", element, namespace, false); if (cur != null) { // Attribute type = cur.getAttribute("type", xsiNamespace); // String tval = type.getValue(); // String extype = namespace.getPrefix() + ":" + // Integer.class.getSimpleName(); // if ( extype.equals(tval) ) // { pol.dimension = getChildTextAsLong("dimension", element, namespace, true); // } // else // throw new ObservationParsingException("unsupported dimension // type: " + tval); } return pol; }
From source file:ca.nrc.cadc.caom2.xml.ObservationReader.java
License:Open Source License
protected void addKeywordsToList(Collection<String> list, Element element, Namespace ns) throws ObservationParsingException { Element kwe = element.getChild("keywords", ns); log.debug("addKeywordsToList: " + kwe); if (kwe == null) { return;/* w w w . j a v a2 s . co m*/ } List kws = kwe.getChildren("keyword", ns); log.debug("addKeywordsToList: " + kws.size()); Iterator it = kws.iterator(); while (it.hasNext()) { Element k = (Element) it.next(); String s = k.getTextTrim(); log.debug("addKeywordsToList: " + s); list.add(s); } }
From source file:ca.nrc.cadc.uws.JobListReader.java
License:Open Source License
private List<JobRef> parseJobList(Document doc) throws ParseException, DataConversionException { Element root = doc.getRootElement(); List<Element> children = root.getChildren(); Iterator<Element> childIterator = children.iterator(); List<JobRef> jobs = new ArrayList<JobRef>(); Element next = null;/* w w w. j a va2 s. co m*/ JobRef jobRef = null; ExecutionPhase executionPhase = null; Date creationTime = null; Attribute nil = null; String runID = null; String ownerID = null; while (childIterator.hasNext()) { next = childIterator.next(); String jobID = next.getAttributeValue("id"); Element phaseElement = next.getChild(JobAttribute.EXECUTION_PHASE.getAttributeName(), UWS.NS); String phase = phaseElement.getValue(); executionPhase = ExecutionPhase.valueOf(phase); Element creationTimeElement = next.getChild(JobAttribute.CREATION_TIME.getAttributeName(), UWS.NS); String time = creationTimeElement.getValue(); creationTime = dateFormat.parse(time); Element runIDElement = next.getChild(JobAttribute.RUN_ID.getAttributeName(), UWS.NS); nil = runIDElement.getAttribute("nil", UWS.XSI_NS); if (nil != null && nil.getBooleanValue()) runID = null; else runID = runIDElement.getTextTrim(); Element ownerIDElement = next.getChild(JobAttribute.OWNER_ID.getAttributeName(), UWS.NS); ownerID = ownerIDElement.getTextTrim(); jobRef = new JobRef(jobID, executionPhase, creationTime, runID, ownerID); jobs.add(jobRef); } return jobs; }
From source file:ca.nrc.cadc.uws.JobReader.java
License:Open Source License
private String parseStringContent(Element e) throws DataConversionException { if (e == null) return null; Attribute nil = e.getAttribute("nil", UWS.XSI_NS); if (nil != null && nil.getBooleanValue()) return null; return e.getTextTrim(); }
From source file:ca.nrc.cadc.vosi.TableReader.java
License:Open Source License
static TableDesc toTable(String schemaName, Element te, Namespace xsi) { String tn = te.getChildTextTrim("name"); TableDesc td = new TableDesc(schemaName, tn); List<Element> cols = te.getChildren("column"); for (Element ce : cols) { String cn = ce.getChildTextTrim("name"); Element dte = ce.getChild("dataType"); String dtt = dte.getAttributeValue("type", xsi); String dtv = dte.getTextTrim(); if (TAP_TYPE.equals(dtt)) dtv = "adql:" + dtv; else if (VOT_TYPE.equals(dtt)) dtv = "vot:" + dtv; Integer arraysize = null; String as = dte.getAttributeValue("size"); if (as != null) arraysize = new Integer(as); ColumnDesc cd = new ColumnDesc(tn, cn, dtv, arraysize); td.getColumnDescs().add(cd);/*from w w w .ja v a 2 s . c o m*/ } List<Element> keys = te.getChildren("foreignKey"); int i = 1; for (Element fk : keys) { String keyID = tn + "_key" + i; String tt = fk.getChildTextTrim("targetTable"); KeyDesc kd = new KeyDesc(keyID, tn, tt); List<Element> fkcols = fk.getChildren("fkColumn"); for (Element fkc : fkcols) { String fc = fkc.getChildTextTrim("fromColumn"); String tc = fkc.getChildTextTrim("targetColumn"); KeyColumnDesc kcd = new KeyColumnDesc(keyID, fc, tc); kd.getKeyColumnDescs().add(kcd); } td.getKeyDescs().add(kd); } return td; }
From source file:com.ardor3d.extension.model.collada.jdom.plugin.GoogleEarthPlugin.java
License:Open Source License
@Override public boolean processExtra(final Element extra, final Object[] params) { if (params.length > 0 && params[0] instanceof Mesh) { final Mesh mesh = (Mesh) params[0]; // should have a child: <technique profile="GOOGLEEARTH"> final Element technique = extra.getChild("technique"); if (technique != null) { final Attribute profile = technique.getAttribute("profile"); if (profile != null && "GOOGLEEARTH".equalsIgnoreCase(profile.getValue())) { for (final Element child : technique.getChildren()) { // disable back face culling if it's been enabled. if ("double_sided".equalsIgnoreCase(child.getName()) && "1".equals(child.getTextTrim())) { final CullState cs = new CullState(); cs.setEnabled(false); mesh.setRenderState(cs); }/* w w w. j ava 2s .c o m*/ } return true; } } } return false; }
From source file:com.bennavetta.util.tycho.impl.DefaultWrapperGenerator.java
License:Apache License
private void writeModules(List<String> modules, File pomFile) throws JDOMException, IOException { SAXBuilder builder = new SAXBuilder(); Document pom = builder.build(pomFile); Namespace pomNs = pom.getRootElement().getNamespace(); Element modulesElem = pom.getRootElement().getChild("modules", pomNs); if (modulesElem == null) { modulesElem = new Element("modules", pomNs); pom.getRootElement().addContent(modulesElem); }/*from ww w. j a v a 2 s . c o m*/ for (String module : modules) { boolean exists = false; for (Element existingModule : modulesElem.getChildren()) { if (existingModule.getTextTrim().equals(module)) { exists = true; break; } } if (!exists) { Element moduleElem = new Element("module", pomNs); moduleElem.setText(module); modulesElem.addContent(moduleElem); } } XMLOutputter xout = new XMLOutputter(Format.getPrettyFormat().setIndent("\t")); try (FileOutputStream out = new FileOutputStream(pomFile)) { xout.output(pom, out); } }
From source file:com.bio4j.neo4jdb.programs.ImportUniprot.java
License:Open Source License
private static void importProteinComments(XMLElement entryXMLElem, BatchInserter inserter, BatchInserterIndexProvider indexProvider, long currentProteinId, String proteinSequence, UniprotDataXML uniprotDataXML) { //---------------indexes declaration--------------------------- BatchInserterIndex commentTypeNameIndex = indexProvider.nodeIndex(CommentTypeNode.COMMENT_TYPE_NAME_INDEX, MapUtil.stringMap(PROVIDER_ST, LUCENE_ST, TYPE_ST, EXACT_ST)); BatchInserterIndex subcellularLocationNameIndex = indexProvider.nodeIndex( SubcellularLocationNode.SUBCELLULAR_LOCATION_NAME_INDEX, MapUtil.stringMap(PROVIDER_ST, LUCENE_ST, TYPE_ST, EXACT_ST)); BatchInserterIndex isoformIdIndex = indexProvider.nodeIndex(IsoformNode.ISOFORM_ID_INDEX, MapUtil.stringMap(PROVIDER_ST, LUCENE_ST, TYPE_ST, EXACT_ST)); BatchInserterIndex nodeTypeIndex = indexProvider.nodeIndex(Bio4jManager.NODE_TYPE_INDEX_NAME, MapUtil.stringMap(PROVIDER_ST, LUCENE_ST, TYPE_ST, EXACT_ST)); //----------------------------------------------------------- List<Element> comments = entryXMLElem.asJDomElement().getChildren(UniprotStuff.COMMENT_TAG_NAME); for (Element commentElem : comments) { String commentTypeSt = commentElem.getAttributeValue(UniprotStuff.COMMENT_TYPE_ATTRIBUTE); Element textElem = commentElem.getChild("text"); String commentTextSt = ""; String commentStatusSt = ""; String commentEvidenceSt = ""; if (textElem != null) { commentTextSt = textElem.getText(); commentStatusSt = textElem.getAttributeValue("status"); if (commentStatusSt == null) { commentStatusSt = ""; }/*from ww w .j a v a 2 s . c o m*/ commentEvidenceSt = textElem.getAttributeValue("evidence"); if (commentEvidenceSt == null) { commentEvidenceSt = ""; } } commentProperties.put(BasicCommentRel.TEXT_PROPERTY, commentTextSt); commentProperties.put(BasicCommentRel.STATUS_PROPERTY, commentStatusSt); commentProperties.put(BasicCommentRel.EVIDENCE_PROPERTY, commentEvidenceSt); //-----------------COMMENT TYPE NODE RETRIEVING/CREATION---------------------- //long commentTypeId = indexService.getSingleNode(CommentTypeNode.COMMENT_TYPE_NAME_INDEX, commentTypeSt); IndexHits<Long> commentTypeNameIndexHits = commentTypeNameIndex .get(CommentTypeNode.COMMENT_TYPE_NAME_INDEX, commentTypeSt); long commentTypeId = -1; if (commentTypeNameIndexHits.hasNext()) { commentTypeId = commentTypeNameIndexHits.getSingle(); } commentTypeNameIndexHits.close(); if (commentTypeId < 0) { commentTypeProperties.put(CommentTypeNode.NAME_PROPERTY, commentTypeSt); commentTypeId = inserter.createNode(commentTypeProperties); commentTypeNameIndex.add(commentTypeId, MapUtil.map(CommentTypeNode.COMMENT_TYPE_NAME_INDEX, commentTypeSt)); //----flushing the indexation---- commentTypeNameIndex.flush(); //---adding comment type node to node_type index---- nodeTypeIndex.add(commentTypeId, MapUtil.map(Bio4jManager.NODE_TYPE_INDEX_NAME, CommentTypeNode.NODE_TYPE)); } //-----toxic dose---------------- switch (commentTypeSt) { case ToxicDoseCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, toxicDoseCommentRel, commentProperties); break; case CautionCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, cautionCommentRel, commentProperties); break; case CofactorCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, cofactorCommentRel, commentProperties); break; case DiseaseCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, diseaseCommentRel, commentProperties); break; case OnlineInformationCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: onlineInformationCommentProperties.put(OnlineInformationCommentRel.STATUS_PROPERTY, commentStatusSt); onlineInformationCommentProperties.put(OnlineInformationCommentRel.EVIDENCE_PROPERTY, commentEvidenceSt); onlineInformationCommentProperties.put(OnlineInformationCommentRel.TEXT_PROPERTY, commentTextSt); String nameSt = commentElem.getAttributeValue("name"); if (nameSt == null) { nameSt = ""; } String linkSt = ""; Element linkElem = commentElem.getChild("link"); if (linkElem != null) { String uriSt = linkElem.getAttributeValue("uri"); if (uriSt != null) { linkSt = uriSt; } } onlineInformationCommentProperties.put(OnlineInformationCommentRel.NAME_PROPERTY, nameSt); onlineInformationCommentProperties.put(OnlineInformationCommentRel.LINK_PROPERTY, linkSt); inserter.createRelationship(currentProteinId, commentTypeId, onlineInformationCommentRel, onlineInformationCommentProperties); break; case TissueSpecificityCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, tissueSpecificityCommentRel, commentProperties); break; case FunctionCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, functionCommentRel, commentProperties); break; case BiotechnologyCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, biotechnologyCommentRel, commentProperties); break; case SubunitCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, subunitCommentRel, commentProperties); break; case PolymorphismCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, polymorphismCommentRel, commentProperties); break; case DomainCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, domainCommentRel, commentProperties); break; case PostTranslationalModificationCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, postTranslationalModificationCommentRel, commentProperties); break; case CatalyticActivityCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, catalyticActivityCommentRel, commentProperties); break; case DisruptionPhenotypeCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, disruptionPhenotypeCommentRel, commentProperties); break; case BioPhysicoChemicalPropertiesCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: biophysicochemicalCommentProperties.put(BioPhysicoChemicalPropertiesCommentRel.STATUS_PROPERTY, commentStatusSt); biophysicochemicalCommentProperties.put(BioPhysicoChemicalPropertiesCommentRel.EVIDENCE_PROPERTY, commentEvidenceSt); biophysicochemicalCommentProperties.put(BioPhysicoChemicalPropertiesCommentRel.TEXT_PROPERTY, commentTextSt); String phDependenceSt = commentElem.getChildText("phDependence"); String temperatureDependenceSt = commentElem.getChildText("temperatureDependence"); if (phDependenceSt == null) { phDependenceSt = ""; } if (temperatureDependenceSt == null) { temperatureDependenceSt = ""; } String absorptionMaxSt = ""; String absorptionTextSt = ""; Element absorptionElem = commentElem.getChild("absorption"); if (absorptionElem != null) { absorptionMaxSt = absorptionElem.getChildText("max"); absorptionTextSt = absorptionElem.getChildText("text"); if (absorptionMaxSt == null) { absorptionMaxSt = ""; } if (absorptionTextSt == null) { absorptionTextSt = ""; } } String kineticsSt = ""; Element kineticsElem = commentElem.getChild("kinetics"); if (kineticsElem != null) { kineticsSt = new XMLElement(kineticsElem).toString(); } String redoxPotentialSt = ""; String redoxPotentialEvidenceSt = ""; Element redoxPotentialElem = commentElem.getChild("redoxPotential"); if (redoxPotentialElem != null) { redoxPotentialSt = redoxPotentialElem.getText(); redoxPotentialEvidenceSt = redoxPotentialElem.getAttributeValue("evidence"); if (redoxPotentialSt == null) { redoxPotentialSt = ""; } if (redoxPotentialEvidenceSt == null) { redoxPotentialEvidenceSt = ""; } } biophysicochemicalCommentProperties.put( BioPhysicoChemicalPropertiesCommentRel.TEMPERATURE_DEPENDENCE_PROPERTY, temperatureDependenceSt); biophysicochemicalCommentProperties .put(BioPhysicoChemicalPropertiesCommentRel.PH_DEPENDENCE_PROPERTY, phDependenceSt); biophysicochemicalCommentProperties .put(BioPhysicoChemicalPropertiesCommentRel.KINETICS_XML_PROPERTY, kineticsSt); biophysicochemicalCommentProperties .put(BioPhysicoChemicalPropertiesCommentRel.ABSORPTION_MAX_PROPERTY, absorptionMaxSt); biophysicochemicalCommentProperties .put(BioPhysicoChemicalPropertiesCommentRel.ABSORPTION_TEXT_PROPERTY, absorptionTextSt); biophysicochemicalCommentProperties.put( BioPhysicoChemicalPropertiesCommentRel.REDOX_POTENTIAL_EVIDENCE_PROPERTY, redoxPotentialEvidenceSt); biophysicochemicalCommentProperties .put(BioPhysicoChemicalPropertiesCommentRel.REDOX_POTENTIAL_PROPERTY, redoxPotentialSt); inserter.createRelationship(currentProteinId, commentTypeId, bioPhysicoChemicalPropertiesCommentRel, biophysicochemicalCommentProperties); break; case AllergenCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, allergenCommentRel, commentProperties); break; case PathwayCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, pathwayCommentRel, commentProperties); break; case InductionCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, inductionCommentRel, commentProperties); break; case ProteinSubcellularLocationRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: if (uniprotDataXML.getSubcellularLocations()) { List<Element> subcLocations = commentElem .getChildren(UniprotStuff.SUBCELLULAR_LOCATION_TAG_NAME); for (Element subcLocation : subcLocations) { List<Element> locations = subcLocation.getChildren(UniprotStuff.LOCATION_TAG_NAME); Element firstLocation = locations.get(0); //long firstLocationId = indexService.getSingleNode(SubcellularLocationNode.SUBCELLULAR_LOCATION_NAME_INDEX, firstLocation.getTextTrim()); long firstLocationId = -1; IndexHits<Long> firstLocationIndexHits = subcellularLocationNameIndex.get( SubcellularLocationNode.SUBCELLULAR_LOCATION_NAME_INDEX, firstLocation.getTextTrim()); if (firstLocationIndexHits.hasNext()) { firstLocationId = firstLocationIndexHits.getSingle(); } firstLocationIndexHits.close(); long lastLocationId = firstLocationId; if (firstLocationId < 0) { subcellularLocationProperties.put(SubcellularLocationNode.NAME_PROPERTY, firstLocation.getTextTrim()); lastLocationId = createSubcellularLocationNode(subcellularLocationProperties, inserter, subcellularLocationNameIndex, nodeTypeIndex); //---flushing subcellular location name index--- subcellularLocationNameIndex.flush(); } for (int i = 1; i < locations.size(); i++) { long tempLocationId; IndexHits<Long> tempLocationIndexHits = subcellularLocationNameIndex.get( SubcellularLocationNode.SUBCELLULAR_LOCATION_NAME_INDEX, locations.get(i).getTextTrim()); if (tempLocationIndexHits.hasNext()) { tempLocationId = tempLocationIndexHits.getSingle(); tempLocationIndexHits.close(); } else { subcellularLocationProperties.put(SubcellularLocationNode.NAME_PROPERTY, locations.get(i).getTextTrim()); tempLocationId = createSubcellularLocationNode(subcellularLocationProperties, inserter, subcellularLocationNameIndex, nodeTypeIndex); subcellularLocationNameIndex.flush(); } inserter.createRelationship(tempLocationId, lastLocationId, subcellularLocationParentRel, null); lastLocationId = tempLocationId; } Element lastLocation = locations.get(locations.size() - 1); String evidenceSt = lastLocation.getAttributeValue(UniprotStuff.EVIDENCE_ATTRIBUTE); String statusSt = lastLocation.getAttributeValue(UniprotStuff.STATUS_ATTRIBUTE); String topologyStatusSt = ""; String topologySt = ""; Element topologyElem = subcLocation.getChild("topology"); if (topologyElem != null) { topologySt = topologyElem.getText(); topologyStatusSt = topologyElem.getAttributeValue("status"); } if (topologyStatusSt == null) { topologyStatusSt = ""; } if (topologySt == null) { topologySt = ""; } if (evidenceSt == null) { evidenceSt = ""; } if (statusSt == null) { statusSt = ""; } proteinSubcellularLocationProperties.put(ProteinSubcellularLocationRel.EVIDENCE_PROPERTY, evidenceSt); proteinSubcellularLocationProperties.put(ProteinSubcellularLocationRel.STATUS_PROPERTY, statusSt); proteinSubcellularLocationProperties.put(ProteinSubcellularLocationRel.TOPOLOGY_PROPERTY, topologySt); proteinSubcellularLocationProperties .put(ProteinSubcellularLocationRel.TOPOLOGY_STATUS_PROPERTY, topologyStatusSt); inserter.createRelationship(currentProteinId, lastLocationId, proteinSubcellularLocationRel, proteinSubcellularLocationProperties); } } break; case UniprotStuff.COMMENT_ALTERNATIVE_PRODUCTS_TYPE: if (uniprotDataXML.getIsoforms()) { List<Element> eventList = commentElem.getChildren("event"); List<Element> isoformList = commentElem.getChildren("isoform"); for (Element isoformElem : isoformList) { String isoformIdSt = isoformElem.getChildText("id"); String isoformNoteSt = isoformElem.getChildText("note"); String isoformNameSt = isoformElem.getChildText("name"); String isoformSeqSt = ""; Element isoSeqElem = isoformElem.getChild("sequence"); if (isoSeqElem != null) { String isoSeqTypeSt = isoSeqElem.getAttributeValue("type"); if (isoSeqTypeSt.equals("displayed")) { isoformSeqSt = proteinSequence; } } if (isoformNoteSt == null) { isoformNoteSt = ""; } if (isoformNameSt == null) { isoformNameSt = ""; } isoformProperties.put(IsoformNode.ID_PROPERTY, isoformIdSt); isoformProperties.put(IsoformNode.NOTE_PROPERTY, isoformNoteSt); isoformProperties.put(IsoformNode.NAME_PROPERTY, isoformNameSt); isoformProperties.put(IsoformNode.SEQUENCE_PROPERTY, isoformSeqSt); //-------------------------------------------------------- //long isoformId = indexService.getSingleNode(IsoformNode.ISOFORM_ID_INDEX, isoformIdSt); long isoformId = -1; IndexHits<Long> isoformIdIndexHits = isoformIdIndex.get(IsoformNode.ISOFORM_ID_INDEX, isoformIdSt); if (isoformIdIndexHits.hasNext()) { isoformId = isoformIdIndexHits.getSingle(); } isoformIdIndexHits.close(); if (isoformId < 0) { isoformId = createIsoformNode(isoformProperties, inserter, isoformIdIndex, nodeTypeIndex); } for (Element eventElem : eventList) { String eventTypeSt = eventElem.getAttributeValue("type"); switch (eventTypeSt) { case AlternativeProductInitiationRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(isoformId, alternativeProductInitiationId, isoformEventGeneratorRel, null); break; case AlternativeProductPromoterRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(isoformId, alternativeProductPromoterId, isoformEventGeneratorRel, null); break; case AlternativeProductRibosomalFrameshiftingRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(isoformId, alternativeProductRibosomalFrameshiftingId, isoformEventGeneratorRel, null); break; case AlternativeProductSplicingRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(isoformId, alternativeProductSplicingId, isoformEventGeneratorRel, null); break; } } //protein isoform relationship inserter.createRelationship(currentProteinId, isoformId, proteinIsoformRel, null); } } break; case UniprotStuff.COMMENT_SEQUENCE_CAUTION_TYPE: sequenceCautionProperties.put(BasicProteinSequenceCautionRel.EVIDENCE_PROPERTY, commentEvidenceSt); sequenceCautionProperties.put(BasicProteinSequenceCautionRel.STATUS_PROPERTY, commentStatusSt); sequenceCautionProperties.put(BasicProteinSequenceCautionRel.TEXT_PROPERTY, commentTextSt); Element conflictElem = commentElem.getChild("conflict"); if (conflictElem != null) { String conflictTypeSt = conflictElem.getAttributeValue("type"); String resourceSt = ""; String idSt = ""; String versionSt = ""; ArrayList<String> positionsList = new ArrayList<>(); Element sequenceElem = conflictElem.getChild("sequence"); if (sequenceElem != null) { resourceSt = sequenceElem.getAttributeValue("resource"); if (resourceSt == null) { resourceSt = ""; } idSt = sequenceElem.getAttributeValue("id"); if (idSt == null) { idSt = ""; } versionSt = sequenceElem.getAttributeValue("version"); if (versionSt == null) { versionSt = ""; } } Element locationElem = commentElem.getChild("location"); if (locationElem != null) { Element positionElem = locationElem.getChild("position"); if (positionElem != null) { String tempPos = positionElem.getAttributeValue("position"); if (tempPos != null) { positionsList.add(tempPos); } } } sequenceCautionProperties.put(BasicProteinSequenceCautionRel.RESOURCE_PROPERTY, resourceSt); sequenceCautionProperties.put(BasicProteinSequenceCautionRel.ID_PROPERTY, idSt); sequenceCautionProperties.put(BasicProteinSequenceCautionRel.VERSION_PROPERTY, versionSt); switch (conflictTypeSt) { case ProteinErroneousGeneModelPredictionRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: if (positionsList.size() > 0) { for (String tempPosition : positionsList) { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, tempPosition); inserter.createRelationship(currentProteinId, seqCautionErroneousGeneModelPredictionId, proteinErroneousGeneModelPredictionRel, sequenceCautionProperties); } } else { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, ""); inserter.createRelationship(currentProteinId, seqCautionErroneousGeneModelPredictionId, proteinErroneousGeneModelPredictionRel, sequenceCautionProperties); } break; case ProteinErroneousInitiationRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: if (positionsList.size() > 0) { for (String tempPosition : positionsList) { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, tempPosition); inserter.createRelationship(currentProteinId, seqCautionErroneousInitiationId, proteinErroneousInitiationRel, sequenceCautionProperties); } } else { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, ""); inserter.createRelationship(currentProteinId, seqCautionErroneousInitiationId, proteinErroneousInitiationRel, sequenceCautionProperties); } break; case ProteinErroneousTranslationRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: if (positionsList.size() > 0) { for (String tempPosition : positionsList) { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, tempPosition); inserter.createRelationship(currentProteinId, seqCautionErroneousTranslationId, proteinErroneousTranslationRel, sequenceCautionProperties); } } else { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, ""); inserter.createRelationship(currentProteinId, seqCautionErroneousTranslationId, proteinErroneousTranslationRel, sequenceCautionProperties); } break; case ProteinErroneousTerminationRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: if (positionsList.size() > 0) { for (String tempPosition : positionsList) { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, tempPosition); inserter.createRelationship(currentProteinId, seqCautionErroneousTerminationId, proteinErroneousTerminationRel, sequenceCautionProperties); } } else { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, ""); inserter.createRelationship(currentProteinId, seqCautionErroneousTerminationId, proteinErroneousTerminationRel, sequenceCautionProperties); } break; case ProteinFrameshiftRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: if (positionsList.size() > 0) { for (String tempPosition : positionsList) { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, tempPosition); inserter.createRelationship(currentProteinId, seqCautionFrameshiftId, proteinFrameshiftRel, sequenceCautionProperties); } } else { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, ""); inserter.createRelationship(currentProteinId, seqCautionFrameshiftId, proteinFrameshiftRel, sequenceCautionProperties); } break; case ProteinMiscellaneousDiscrepancyRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: if (positionsList.size() > 0) { for (String tempPosition : positionsList) { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, tempPosition); inserter.createRelationship(currentProteinId, seqCautionMiscellaneousDiscrepancyId, proteinMiscellaneousDiscrepancyRel, sequenceCautionProperties); } } else { sequenceCautionProperties.put(BasicProteinSequenceCautionRel.POSITION_PROPERTY, ""); inserter.createRelationship(currentProteinId, seqCautionMiscellaneousDiscrepancyId, proteinMiscellaneousDiscrepancyRel, sequenceCautionProperties); } break; } } break; case DevelopmentalStageCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, developmentalStageCommentRel, commentProperties); break; case MiscellaneousCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, miscellaneousCommentRel, commentProperties); break; case SimilarityCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, similarityCommentRel, commentProperties); break; case RnaEditingCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: rnaEditingCommentProperties.put(RnaEditingCommentRel.STATUS_PROPERTY, commentStatusSt); rnaEditingCommentProperties.put(RnaEditingCommentRel.EVIDENCE_PROPERTY, commentEvidenceSt); rnaEditingCommentProperties.put(RnaEditingCommentRel.TEXT_PROPERTY, commentTextSt); List<Element> locationsList = commentElem.getChildren("location"); for (Element tempLoc : locationsList) { String positionSt = tempLoc.getChild("position").getAttributeValue("position"); rnaEditingCommentProperties.put(RnaEditingCommentRel.POSITION_PROPERTY, positionSt); inserter.createRelationship(currentProteinId, commentTypeId, rnaEditingCommentRel, rnaEditingCommentProperties); } break; case PharmaceuticalCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, pharmaceuticalCommentRel, commentProperties); break; case EnzymeRegulationCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: inserter.createRelationship(currentProteinId, commentTypeId, enzymeRegulationCommentRel, commentProperties); break; case MassSpectrometryCommentRel.UNIPROT_ATTRIBUTE_TYPE_VALUE: String methodSt = commentElem.getAttributeValue("method"); String massSt = commentElem.getAttributeValue("mass"); if (methodSt == null) { methodSt = ""; } if (massSt == null) { massSt = ""; } String beginSt = ""; String endSt = ""; Element locationElem = commentElem.getChild("location"); if (locationElem != null) { Element beginElem = commentElem.getChild("begin"); Element endElem = commentElem.getChild("end"); if (beginElem != null) { beginSt = beginElem.getAttributeValue("position"); } if (endElem != null) { endSt = endElem.getAttributeValue("position"); } } massSpectrometryCommentProperties.put(MassSpectrometryCommentRel.STATUS_PROPERTY, commentStatusSt); massSpectrometryCommentProperties.put(MassSpectrometryCommentRel.EVIDENCE_PROPERTY, commentEvidenceSt); massSpectrometryCommentProperties.put(MassSpectrometryCommentRel.TEXT_PROPERTY, commentTextSt); massSpectrometryCommentProperties.put(MassSpectrometryCommentRel.METHOD_PROPERTY, methodSt); massSpectrometryCommentProperties.put(MassSpectrometryCommentRel.MASS_PROPERTY, massSt); massSpectrometryCommentProperties.put(MassSpectrometryCommentRel.BEGIN_PROPERTY, beginSt); massSpectrometryCommentProperties.put(MassSpectrometryCommentRel.END_PROPERTY, endSt); inserter.createRelationship(currentProteinId, commentTypeId, massSpectrometryCommentRel, massSpectrometryCommentProperties); break; } } }