Changeset 3131
- Timestamp:
- 03/02/10 11:24:34 (5 months ago)
- Location:
- trunk/src/core/org/pathvisio/model
- Files:
-
- 4 modified
-
GpmlFormat.java (modified) (1 diff)
-
GpmlFormat200X.java (modified) (2 diffs)
-
GpmlFormat2010a.java (modified) (2 diffs)
-
GpmlFormatAbstract.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/org/pathvisio/model/GpmlFormat.java
r3103 r3131 48 48 public static final Namespace RDF = Namespace.getNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); 49 49 public static final Namespace RDFS = Namespace.getNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); 50 public static final Namespace BIOPAX = Namespace.getNamespace("bp", "http://www.biopax.org/release/biopax-level 2.owl#");50 public static final Namespace BIOPAX = Namespace.getNamespace("bp", "http://www.biopax.org/release/biopax-level3.owl#"); 51 51 public static final Namespace OWL = Namespace.getNamespace("owl", "http://www.w3.org/2002/07/owl#"); 52 52 -
trunk/src/core/org/pathvisio/model/GpmlFormat200X.java
r3130 r3131 23 23 24 24 import org.bridgedb.DataSource; 25 import org.jdom.Attribute; 26 import org.jdom.Document; 25 27 import org.jdom.Element; 26 28 import org.jdom.Namespace; … … 479 481 } 480 482 483 protected void mapBiopax(PathwayElement o, Element e) throws ConverterException 484 { 485 //this method clones all content, 486 //getContent will leave them attached to the parent, which we don't want 487 //We can safely remove them, since the JDOM element isn't used anymore after this method 488 Element root = new Element("RDF", GpmlFormat.RDF); 489 root.addNamespaceDeclaration(GpmlFormat.RDFS); 490 root.addNamespaceDeclaration(GpmlFormat.RDF); 491 root.addNamespaceDeclaration(GpmlFormat.OWL); 492 root.addNamespaceDeclaration(GpmlFormat.BIOPAX); 493 root.setAttribute(new Attribute("base", getGpmlNamespace().getURI() + "#", Namespace.XML_NAMESPACE)); 494 //Element owl = new Element("Ontology", OWL); 495 //owl.setAttribute(new Attribute("about", "", RDF)); 496 //Element imp = new Element("imports", OWL); 497 //imp.setAttribute(new Attribute("resource", BIOPAX.getURI(), RDF)); 498 //owl.addContent(imp); 499 //root.addContent(owl); 500 501 root.addContent(e.cloneContent()); 502 Document bp = new Document(root); 503 504 updateBiopaxNamespace(root); 505 o.setBiopax(bp); 506 } 507 508 private static final Namespace BP_LEV2 = Namespace.getNamespace("bp", "http://www.biopax.org/release/biopax-level2.owl#"); 509 510 /** 511 * Convert the namespace of biopax element from old level2 to new level3. 512 * Starting from GpmlFormat2010a, we only support level 3. 513 * <p> 514 * We ignore all other differences between level 2 and level 3 here. For 515 * PublicationXref, it doesn't matter. 516 */ 517 private void updateBiopaxNamespace(Element e) 518 { 519 if (e.getNamespace().equals(BP_LEV2)) 520 { 521 e.setNamespace(GpmlFormat.BIOPAX); 522 } 523 for (Object f : e.getChildren()) 524 { 525 updateBiopaxNamespace((Element)f); 526 } 527 } 528 481 529 } -
trunk/src/core/org/pathvisio/model/GpmlFormat2010a.java
r3130 r3131 28 28 29 29 import org.bridgedb.DataSource; 30 import org.jdom.Attribute; 30 31 import org.jdom.Document; 31 32 import org.jdom.Element; … … 788 789 } 789 790 791 protected void mapBiopax(PathwayElement o, Element e) throws ConverterException 792 { 793 //this method clones all content, 794 //getContent will leave them attached to the parent, which we don't want 795 //We can safely remove them, since the JDOM element isn't used anymore after this method 796 Element root = new Element("RDF", GpmlFormat.RDF); 797 root.addNamespaceDeclaration(GpmlFormat.RDFS); 798 root.addNamespaceDeclaration(GpmlFormat.RDF); 799 root.addNamespaceDeclaration(GpmlFormat.OWL); 800 root.addNamespaceDeclaration(GpmlFormat.BIOPAX); 801 root.setAttribute(new Attribute("base", getGpmlNamespace().getURI() + "#", Namespace.XML_NAMESPACE)); 802 //Element owl = new Element("Ontology", OWL); 803 //owl.setAttribute(new Attribute("about", "", RDF)); 804 //Element imp = new Element("imports", OWL); 805 //imp.setAttribute(new Attribute("resource", BIOPAX.getURI(), RDF)); 806 //owl.addContent(imp); 807 //root.addContent(owl); 808 809 root.addContent(e.cloneContent()); 810 Document bp = new Document(root); 811 812 o.setBiopax(bp); 813 } 814 790 815 } -
trunk/src/core/org/pathvisio/model/GpmlFormatAbstract.java
r3126 r3131 447 447 mapMappInfoDataVariable(o, e); 448 448 } 449 450 protected void mapBiopax(PathwayElement o, Element e) throws ConverterException 451 { 452 //this method clones all content, 453 //getContent will leave them attached to the parent, which we don't want 454 //We can safely remove them, since the JDOM element isn't used anymore after this method 455 Element root = new Element("RDF", GpmlFormat.RDF); 456 root.addNamespaceDeclaration(GpmlFormat.RDFS); 457 root.addNamespaceDeclaration(GpmlFormat.RDF); 458 root.addNamespaceDeclaration(GpmlFormat.OWL); 459 root.addNamespaceDeclaration(GpmlFormat.BIOPAX); 460 root.setAttribute(new Attribute("base", nsGPML.getURI() + "#", Namespace.XML_NAMESPACE)); 461 //Element owl = new Element("Ontology", OWL); 462 //owl.setAttribute(new Attribute("about", "", RDF)); 463 //Element imp = new Element("imports", OWL); 464 //imp.setAttribute(new Attribute("resource", BIOPAX.getURI(), RDF)); 465 //owl.addContent(imp); 466 //root.addContent(owl); 467 468 root.addContent(e.cloneContent()); 469 Document bp = new Document(root); 470 471 o.setBiopax(bp); 472 } 473 449 474 450 protected void updateBiopax(PathwayElement o, Element e) throws ConverterException 475 451 {
