From: <km...@us...> - 2011-12-21 14:38:51
|
Revision: 3513 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3513&view=rev Author: kmpf Date: 2011-12-21 14:38:40 +0000 (Wed, 21 Dec 2011) Log Message: ----------- Changed a SPARQL query Modified Paths: -------------- trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java 2011-12-21 10:15:12 UTC (rev 3512) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java 2011-12-21 14:38:40 UTC (rev 3513) @@ -31,6 +31,7 @@ public static final Resource TYR = ResourceFactory.createResource("http://bio2rdf.org/pdb:Tyrosine"); public static final Resource SEL = ResourceFactory.createResource("http://bio2rdf.org/pdb:Selenomethionine"); public static final Resource HYT = ResourceFactory.createResource("http://bio2rdf.org/pdb:2-hydroxy-tryptophan"); + public static final Resource SOC = ResourceFactory.createResource("http://bio2rdf.org/pdb:S-oxyCysteine"); public static HashMap<Resource, File> getAllConfFiles (String dir, String confFileName){ HashMap<Resource, File> aminoAcidsConfFiles = new HashMap<Resource, File>(30); @@ -56,6 +57,8 @@ aminoAcidsConfFiles.put(TYR, new File(dir + confFileName.replace(".conf", "." + TYR.getLocalName() + ".conf"))); aminoAcidsConfFiles.put(SEL, new File(dir + confFileName.replace(".conf", "." + SEL.getLocalName() + ".conf"))); aminoAcidsConfFiles.put(HYT, new File(dir + confFileName.replace(".conf", "." + HYT.getLocalName() + ".conf"))); + aminoAcidsConfFiles.put(SOC, new File(dir + confFileName.replace(".conf", "." + SOC.getLocalName() + ".conf"))); + return aminoAcidsConfFiles; } @@ -85,6 +88,8 @@ resprint.put(TYR, new PrintStream(allConfFiles.get(TYR))); resprint.put(SEL, new PrintStream(allConfFiles.get(SEL))); resprint.put(HYT, new PrintStream(allConfFiles.get(HYT))); + resprint.put(SOC, new PrintStream(allConfFiles.get(SOC))); + } catch (FileNotFoundException e) { e.printStackTrace(); } @@ -116,6 +121,7 @@ resourceString.put(TYR, new StringBuffer(init)); resourceString.put(SEL, new StringBuffer(init)); resourceString.put(HYT, new StringBuffer(init)); + resourceString.put(SOC, new StringBuffer(init)); return resourceString; } Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java 2011-12-21 10:15:12 UTC (rev 3512) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java 2011-12-21 14:38:40 UTC (rev 3513) @@ -103,15 +103,19 @@ Boolean dlLearn = false; Boolean wekaLearn = false; - int dataSet = 1; + int dataSet = 5; /* * data for test purpose */ - PDBProtein testProtein = new PDBProtein("1EDM","B"); -// PDBProtein testProtein = new PDBProtein("1LMB", "3"); -// PDBProtein testProtein = new PDBProtein("8ABP"); + /* +++ Problem IDs +++ + * Warum funktionieren die Abfragen mit den untenstehenden PDB IDs nicht??? + */ +// PDBProtein testProtein = new PDBProtein("1HTR","P"); +// PDBProtein testProtein = new PDBProtein("2W9Y","A"); + PDBProtein testProtein = new PDBProtein("3A4R","A"); + /* * create a training data set @@ -411,6 +415,7 @@ for (int i = 0 ; i < negatives.size() ; i++ ) { lp.append("\"" + negatives.get(i).getURI() + "\", "); try{ + _logger.info("Negative residue: " + negatives.get(i).getURI()); Statement spo = model.getModel().getProperty(negatives.get(i), type); resourceStringBuffer.get(spo.getResource()).append("\"" + negatives.get(i).getURI() + "\", "); } catch (NullPointerException e) { Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-12-21 10:15:12 UTC (rev 3512) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-12-21 14:38:40 UTC (rev 3513) @@ -7,11 +7,7 @@ import java.util.ArrayList; import java.util.HashMap; -import org.apache.log4j.ConsoleAppender; -import org.apache.log4j.FileAppender; -import org.apache.log4j.Level; import org.apache.log4j.Logger; -import org.apache.log4j.SimpleLayout; import org.xml.sax.InputSource; import com.dumontierlab.pdb2rdf.model.PdbRdfModel; @@ -22,7 +18,6 @@ import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; -import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.NodeIterator; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; @@ -205,30 +200,36 @@ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + "PREFIX fn: <http://www.w3.org/2005/xpath-functions#> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + - "CONSTRUCT { ?x1 pdb:beginsAt ?x2 ." + - " ?x1 pdb:endsAt ?x3 ." + - " ?x5 dcterms:isPartOf ?x4 ." + - " ?x5 rdf:type ?x6 ." + - " ?x5 pdb:isImmediatelyBefore ?x7 ." + - " ?x5 pdb:hasChainPosition ?x8 ." + - " ?x8 rdfs:label ?residuePosition ." + - " ?x8 pdb:hasValue ?x9 ." + - " ?organism rdfs:label ?organismName ." + - " ?seq rdf:type pdb:PolymerSequence ." + - " ?seq pdb:hasValue ?sequence . } " + + "CONSTRUCT { " + + " ?x1 pdb:beginsAt ?x2 ." + + " ?x1 pdb:endsAt ?x3 ." + + " ?x5 dcterms:isPartOf ?x4 ." + + " ?x5 rdf:type ?x6 ." + + " ?x5 pdb:isImmediatelyBefore ?x7 ." + + " ?x5 pdb:hasChainPosition ?x8 ." + + " ?x8 pdb:hasValue ?x9 ." + + " ?organism rdfs:label ?organismName ." + + " ?seq rdf:type pdb:PolymerSequence ." + + " ?seq pdb:hasValue ?sequence . " + + "} " + "WHERE { " + - " OPTIONAL { ?x1 rdf:type pdb:Helix ." + - " ?x1 pdb:beginsAt ?x2 ." + - " ?x1 pdb:endsAt ?x3 . } . " + - " ?x3 dcterms:isPartOf ?x4 ." + - " ?x4 rdf:type <http://bio2rdf.org/pdb:Polypeptide(L)> ." + - " ?x5 dcterms:isPartOf ?x4 ." + - " ?x5 rdf:type ?x6 ." + + " OPTIONAL { ?x1 rdf:type pdb:Helix ." + + " ?x1 pdb:beginsAt ?x2 ." + + " ?x1 pdb:endsAt ?x3 . " + + "} . " + + " ?x3 dcterms:isPartOf ?x4 ." + + " ?x4 rdf:type <http://bio2rdf.org/pdb:Polypeptide(L)> ." + + //" <http://bio2rdf.org/pdb:3A4R/chemicalComponent_A0> dcterms:isPartOf ?x4 ." + + //" <http://bio2rdf.org/pdb:3A4R/chemicalComponent_A0> rdf:type ?x6 ." + + //" OPTIONAL { <http://bio2rdf.org/pdb:3A4R/chemicalComponent_A0> pdb:isImmediatelyBefore ?x7 . } ." + + //" <http://bio2rdf.org/pdb:3A4R/chemicalComponent_A0> pdb:hasChainPosition ?x8 ." + + " ?x5 dcterms:isPartOf ?x4 . " + + " ?x5 rdf:type ?x6 ." + // with the optional clause i get the information by which amino acid // a amino acid is followed - " OPTIONAL { ?x5 pdb:isImmediatelyBefore ?x7 . } . " + - " ?x5 pdb:hasChainPosition ?x8 ." + - " ?x8 pdb:hasValue ?x9 Filter (xsd:int(?x9)) ."; + " OPTIONAL { ?x5 pdb:isImmediatelyBefore ?x7 . } ." + + " ?x5 pdb:hasChainPosition ?x8 ." + + " ?x8 pdb:hasValue ?x9 Filter (datatype((?x9)) = xsd:integer) ."; if (chainID.length() == 1 && pdbID.length() == 4) { queryString += @@ -237,11 +238,13 @@ "/chain_" + chainID.toUpperCase() + "> ."; } queryString += - " ?x4 pdb:hasPolymerSequence ?seq . " + - " ?seq rdf:type pdb:PolymerSequence . " + - " ?seq pdb:hasValue ?sequence . " + - " OPTIONAL { ?organism rdfs:label ?organismName " + - "FILTER (str(?organism) = fn:concat(str(?x4), '/extraction/source/gene/organism')) . } . }"; + " ?x4 pdb:hasPolymerSequence ?seq . " + + " ?seq rdf:type pdb:PolymerSequence . " + + " ?seq pdb:hasValue ?sequence . " + + " OPTIONAL { ?organism rdfs:label ?organismName " + + "FILTER (str(?organism) = fn:concat(str(?x4), '/extraction/source/gene/organism')) . " + + "} . " + + "}"; _logger.debug(queryString); Query query = QueryFactory.create(queryString); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |