001/** 002 * Copyright (C) 2007 - 2016, Jens Lehmann 003 * 004 * This file is part of DL-Learner. 005 * 006 * DL-Learner is free software; you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation; either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * DL-Learner is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package org.dllearner.kb.repository.bioportal; 020 021import java.util.ArrayList; 022import java.util.Date; 023import java.util.List; 024 025/** 026 * Simplified version of the 027 * <code>org.ncbo.stanford.bean.concept.OntologyBean</code> class used to decode 028 * the "ontologyBean" element from a successful REST call to a BioPortal 029 * ontology service 030 * 031 * @author csnyulas 032 * 033 */ 034public class OntologyBean implements Comparable<OntologyBean> { 035 036 public static final String DEFAULT_SYNONYM_SLOT = "http://www.w3.org/2004/02/skos/core#altLabel"; 037 public static final String DEFAULT_PREFERRED_NAME_SLOT = "http://www.w3.org/2004/02/skos/core#prefLabel"; 038 public static final String DEFAULT_DEFINITION_SLOT = "http://www.w3.org/2004/02/skos/core#definition"; 039 public static final String DEFAULT_AUTHOR_SLOT = "http://purl.org/dc/elements/1.1/creator"; 040 041 private Integer id; 042 private Integer ontologyId; 043 // virtual view id(s) on the virtual ontology 044 private List<Integer> virtualViewIds = new ArrayList<>(0); 045 private Integer internalVersionNumber; 046 private List<Integer> userIds; 047 private String versionNumber; 048 private String versionStatus; 049 private Byte isRemote; 050 private Byte isReviewed; 051 private Integer statusId; 052 private Date dateCreated; 053 private Date dateReleased; 054 private String oboFoundryId; 055 private Byte isManual; 056 private String displayLabel; 057 private String description; 058 private String abbreviation; 059 private String format; 060 private String contactName; 061 private String contactEmail; 062 private String homepage; 063 private String documentation; 064 private String publication; 065 private String urn; 066 private String codingScheme; 067 private String targetTerminologies; 068 private Byte isFlat; 069 private Byte isFoundry; 070 private Byte isMetadataOnly; 071 private String synonymSlot; 072 private String preferredNameSlot; 073 private String documentationSlot; 074 private String authorSlot; 075 private String slotWithUniqueValue; 076 private Integer preferredMaximumSubclassLimit; 077 private String obsoleteParent; 078 private String naturalLanguage; 079 private String obsoleteProperty; 080 private String licenseInformation; 081 082 private String viewingRestriction; 083 084 private List<UserEntry> userAcl = new ArrayList<>(0); 085 086 private boolean isView = false; 087 088 // category id(s) 089 private List<Integer> categoryIds = new ArrayList<>(0); 090 091 // group id(s) 092 private List<Integer> groupIds = new ArrayList<>(0); 093 094 // file name(s) 095 private List<String> filenames = new ArrayList<>(0); 096 097 // source fileItem 098 // private FileItem fileItem; 099 100 // destination directory 101 private String filePath; 102 103 // Download location of ontology 104 private String downloadLocation; 105 106 // views on this ontology version 107 private List<Integer> hasViews = new ArrayList<>(0); 108 109 // view specific properties 110 private List<Integer> viewOnOntologyVersionId = new ArrayList<>(0); 111 private String viewDefinition; 112 private String viewDefinitionLanguage; 113 private String viewGenerationEngine; 114 115 @Override 116 public String toString() { 117 final int max = 80; 118 String viewDef = this.getViewDefinition(); 119 120 if (viewDef != null && viewDef.length() > max) { 121 viewDef = viewDef.substring(0, max) + "..."; 122 } 123 124 String name = isView ? "OntologyView " : "Ontology "; 125 126 return name + "{Id: " + this.getId() + ", Ontology Id: " + this.getOntologyId() + ", Virtual View Ids: " 127 + this.getVirtualViewIds() + ", Remote: " + this.getIsRemote() + ", Obo Foundry Id: " 128 + this.getOboFoundryId() + ", Internal Version Number: " + this.getInternalVersionNumber() 129 + ", Date Created: " + this.getDateCreated() + ", User Ids: " + this.getUserIds() 130 + ", Version Number: " + this.getVersionNumber() + ", Version Status: " + this.getVersionStatus() 131 + ", Display Label: " + this.getDisplayLabel() + ", Description: " + this.getDescription() 132 + ", Abbreviation: " + this.getAbbreviation() + ", Format: " + this.getFormat() + ", Contact Name: " 133 + this.getContactName() + ", Contact Email: " + this.getContactEmail() + ", Foundry: " 134 + this.getIsFoundry() + " Coding Scheme: " + this.getCodingScheme() + ", Target Terminologies: " 135 + this.getTargetTerminologies() + ", Synonym Slot: " + this.getSynonymSlot() 136 + ", Preferred Name Slot: " + this.getPreferredNameSlot() + ", View Definition: " + viewDef 137 + ", View Definition Language: " + this.getViewDefinitionLanguage() + ", View Generation Engine: " 138 + this.getViewGenerationEngine() + ", View on Ontology Versions: " + this.getViewOnOntologyVersionId() 139 + "}"; 140 } 141 142 public Integer getId() { 143 return id; 144 } 145 146 public void setId(Integer id) { 147 this.id = id; 148 } 149 150 public Integer getOntologyId() { 151 return ontologyId; 152 } 153 154 public void setOntologyId(Integer ontologyId) { 155 this.ontologyId = ontologyId; 156 } 157 158 public List<Integer> getVirtualViewIds() { 159 return virtualViewIds; 160 } 161 162 public void setVirtualViewIds(List<Integer> virtualViewIds) { 163 this.virtualViewIds = virtualViewIds; 164 } 165 166 public Integer getInternalVersionNumber() { 167 return internalVersionNumber; 168 } 169 170 public void setInternalVersionNumber(Integer internalVersionNumber) { 171 this.internalVersionNumber = internalVersionNumber; 172 } 173 174 public List<Integer> getUserIds() { 175 return userIds; 176 } 177 178 public void setUserIds(List<Integer> userIds) { 179 this.userIds = userIds; 180 } 181 182 public String getVersionNumber() { 183 return versionNumber; 184 } 185 186 public void setVersionNumber(String versionNumber) { 187 this.versionNumber = versionNumber; 188 } 189 190 public String getVersionStatus() { 191 return versionStatus; 192 } 193 194 public void setVersionStatus(String versionStatus) { 195 this.versionStatus = versionStatus; 196 } 197 198 public Byte getIsRemote() { 199 return isRemote; 200 } 201 202 public void setIsRemote(Byte isRemote) { 203 this.isRemote = isRemote; 204 } 205 206 public Byte getIsReviewed() { 207 return isReviewed; 208 } 209 210 public void setIsReviewed(Byte isReviewed) { 211 this.isReviewed = isReviewed; 212 } 213 214 public Integer getStatusId() { 215 return statusId; 216 } 217 218 public void setStatusId(Integer statusId) { 219 this.statusId = statusId; 220 } 221 222 public Date getDateCreated() { 223 return dateCreated; 224 } 225 226 public void setDateCreated(Date dateCreated) { 227 this.dateCreated = dateCreated; 228 } 229 230 public Date getDateReleased() { 231 return dateReleased; 232 } 233 234 public void setDateReleased(Date dateReleased) { 235 this.dateReleased = dateReleased; 236 } 237 238 public String getOboFoundryId() { 239 return oboFoundryId; 240 } 241 242 public void setOboFoundryId(String oboFoundryId) { 243 this.oboFoundryId = oboFoundryId; 244 } 245 246 public Byte getIsManual() { 247 return isManual; 248 } 249 250 public void setIsManual(Byte isManual) { 251 this.isManual = isManual; 252 } 253 254 public String getDisplayLabel() { 255 return displayLabel; 256 } 257 258 public void setDisplayLabel(String displayLabel) { 259 this.displayLabel = displayLabel; 260 } 261 262 public String getDescription() { 263 return description; 264 } 265 266 public void setDescription(String description) { 267 this.description = description; 268 } 269 270 public String getAbbreviation() { 271 return abbreviation; 272 } 273 274 public void setAbbreviation(String abbreviation) { 275 this.abbreviation = abbreviation; 276 } 277 278 public String getFormat() { 279 return format; 280 } 281 282 public void setFormat(String format) { 283 this.format = format; 284 } 285 286 public String getContactName() { 287 return contactName; 288 } 289 290 public void setContactName(String contactName) { 291 this.contactName = contactName; 292 } 293 294 public String getContactEmail() { 295 return contactEmail; 296 } 297 298 public void setContactEmail(String contactEmail) { 299 this.contactEmail = contactEmail; 300 } 301 302 public String getHomepage() { 303 return homepage; 304 } 305 306 public void setHomepage(String homepage) { 307 this.homepage = homepage; 308 } 309 310 public String getDocumentation() { 311 return documentation; 312 } 313 314 public void setDocumentation(String documentation) { 315 this.documentation = documentation; 316 } 317 318 public String getPublication() { 319 return publication; 320 } 321 322 public void setPublication(String publication) { 323 this.publication = publication; 324 } 325 326 public String getUrn() { 327 return urn; 328 } 329 330 public void setUrn(String urn) { 331 this.urn = urn; 332 } 333 334 public String getCodingScheme() { 335 return codingScheme; 336 } 337 338 public void setCodingScheme(String codingScheme) { 339 this.codingScheme = codingScheme; 340 } 341 342 public String getTargetTerminologies() { 343 return targetTerminologies; 344 } 345 346 public void setTargetTerminologies(String targetTerminologies) { 347 this.targetTerminologies = targetTerminologies; 348 } 349 350 public Byte getIsFlat() { 351 return isFlat; 352 } 353 354 public void setIsFlat(Byte isFlat) { 355 this.isFlat = isFlat; 356 } 357 358 public Byte getIsFoundry() { 359 return isFoundry; 360 } 361 362 public void setIsFoundry(Byte isFoundry) { 363 this.isFoundry = isFoundry; 364 } 365 366 public Byte getIsMetadataOnly() { 367 return isMetadataOnly; 368 } 369 370 public void setIsMetadataOnly(Byte isMetadataOnly) { 371 this.isMetadataOnly = isMetadataOnly; 372 } 373 374 public String getSynonymSlot() { 375 return synonymSlot; 376 } 377 378 public void setSynonymSlot(String synonymSlot) { 379 this.synonymSlot = synonymSlot; 380 } 381 382 public String getPreferredNameSlot() { 383 return preferredNameSlot; 384 } 385 386 public void setPreferredNameSlot(String preferredNameSlot) { 387 this.preferredNameSlot = preferredNameSlot; 388 } 389 390 public String getDocumentationSlot() { 391 return documentationSlot; 392 } 393 394 public void setDocumentationSlot(String documentationSlot) { 395 this.documentationSlot = documentationSlot; 396 } 397 398 public String getAuthorSlot() { 399 return authorSlot; 400 } 401 402 public void setAuthorSlot(String authorSlot) { 403 this.authorSlot = authorSlot; 404 } 405 406 public String getSlotWithUniqueValue() { 407 return slotWithUniqueValue; 408 } 409 410 public void setSlotWithUniqueValue(String slotWithUniqueValue) { 411 this.slotWithUniqueValue = slotWithUniqueValue; 412 } 413 414 public Integer getPreferredMaximumSubclassLimit() { 415 return preferredMaximumSubclassLimit; 416 } 417 418 public void setPreferredMaximumSubclassLimit(Integer preferredMaximumSubclassLimit) { 419 this.preferredMaximumSubclassLimit = preferredMaximumSubclassLimit; 420 } 421 422 public boolean isView() { 423 return isView; 424 } 425 426 public void setView(boolean isView) { 427 this.isView = isView; 428 } 429 430 public List<Integer> getCategoryIds() { 431 return categoryIds; 432 } 433 434 public void setCategoryIds(List<Integer> categoryIds) { 435 this.categoryIds = categoryIds; 436 } 437 438 public List<Integer> getGroupIds() { 439 return groupIds; 440 } 441 442 public void setGroupIds(List<Integer> groupIds) { 443 this.groupIds = groupIds; 444 } 445 446 public List<String> getFilenames() { 447 return filenames; 448 } 449 450 public void setFilenames(List<String> filenames) { 451 this.filenames = filenames; 452 } 453 454 public String getFilePath() { 455 return filePath; 456 } 457 458 public void setFilePath(String filePath) { 459 this.filePath = filePath; 460 } 461 462 public List<Integer> getHasViews() { 463 return hasViews; 464 } 465 466 public void setHasViews(List<Integer> hasViews) { 467 this.hasViews = hasViews; 468 } 469 470 public List<Integer> getViewOnOntologyVersionId() { 471 return viewOnOntologyVersionId; 472 } 473 474 public void setViewOnOntologyVersionId(List<Integer> viewOnOntologyVersionId) { 475 this.viewOnOntologyVersionId = viewOnOntologyVersionId; 476 } 477 478 public String getViewDefinition() { 479 return viewDefinition; 480 } 481 482 public void setViewDefinition(String viewDefinition) { 483 this.viewDefinition = viewDefinition; 484 } 485 486 public String getViewDefinitionLanguage() { 487 return viewDefinitionLanguage; 488 } 489 490 public void setViewDefinitionLanguage(String viewDefinitionLanguage) { 491 this.viewDefinitionLanguage = viewDefinitionLanguage; 492 } 493 494 public String getViewGenerationEngine() { 495 return viewGenerationEngine; 496 } 497 498 public void setViewGenerationEngine(String viewGenerationEngine) { 499 this.viewGenerationEngine = viewGenerationEngine; 500 } 501 502 public static String getDefaultPreferredNameSlot() { 503 return DEFAULT_PREFERRED_NAME_SLOT; 504 } 505 506 public static String getDefaultDefinitionSlot() { 507 return DEFAULT_DEFINITION_SLOT; 508 } 509 510 public static String getDefaultAuthorSlot() { 511 return DEFAULT_AUTHOR_SLOT; 512 } 513 514 public String getDownloadLocation() { 515 return downloadLocation; 516 } 517 518 public void setDownloadLocation(String downloadLocation) { 519 this.downloadLocation = downloadLocation; 520 } 521 522 /** 523 * @return the userAcl 524 */ 525 public List<UserEntry> getUserAcl() { 526 return userAcl; 527 } 528 529 /** 530 * @param userAcl 531 * the userAcl to set 532 */ 533 public void setUserAcl(List<UserEntry> userAcl) { 534 this.userAcl = userAcl; 535 } 536 537 public String getViewingRestriction() { 538 return viewingRestriction; 539 } 540 541 public void setViewingRestriction(String viewingRestriction) { 542 this.viewingRestriction = viewingRestriction; 543 } 544 545 public String getObsoleteParent() { 546 return obsoleteParent; 547 } 548 549 public void setObsoleteParent(String obsoleteParent) { 550 this.obsoleteParent = obsoleteParent; 551 } 552 553 public String getNaturalLanguage() { 554 return naturalLanguage; 555 } 556 557 public void setNaturalLanguage(String naturalLanguage) { 558 this.naturalLanguage = naturalLanguage; 559 } 560 561 public String getObsoleteProperty() { 562 return obsoleteProperty; 563 } 564 565 public void setObsoleteProperty(String obsoleteProperty) { 566 this.obsoleteProperty = obsoleteProperty; 567 } 568 569 public String getLicenseInformation() { 570 return licenseInformation; 571 } 572 573 public void setLicenseInformation(String licenseInformation) { 574 this.licenseInformation = licenseInformation; 575 } 576 577 @Override 578 public int compareTo(OntologyBean o) { 579 return this.displayLabel.compareTo(o.getDisplayLabel()); 580 } 581 582}