[MOBY-guts] biomoby commit
Gary Schlitz
gss at pub.open-bio.org
Thu Nov 4 22:23:10 UTC 2004
gss
Thu Nov 4 17:23:10 EST 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/parser
In directory pub.open-bio.org:/tmp/cvs-serv31312/src/org/smoby/parser
Modified Files:
Parser.java
Log Message:
Misc
moby-live/S-MOBY/ref-impl/core/src/org/smoby/parser Parser.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/parser/Parser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/parser/Parser.java 2004/07/29 23:35:09 1.7
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/parser/Parser.java 2004/11/04 22:23:10 1.8
@@ -34,6 +34,12 @@
* plus all statements that are reachable from it.
*/
private List subModels = new ArrayList();
+
+ /**
+ * A map relating a property's URI to an Inference model derived from
+ * its base model
+ */
+ private Map cachedPropertyModels = new HashMap();
/**
* Create and return a parser for parsing an N3 file
@@ -426,13 +432,20 @@
*/
private InfModel getPropertyModel(Property p)
{
- Model model = ModelRetriever.retrieveModel(p.getURI());
+ InfModel cachedModel = (InfModel)
+ cachedPropertyModels.get(p.getURI());
- if (model == null) {
- return null;
- } else {
- return ModelFactory.createRDFSModel(model);
+ if (cachedModel == null)
+ {
+ Model model = ModelRetriever.retrieveModel(p.getURI());
+
+ if (model != null)
+ {
+ cachedModel = ModelFactory.createRDFSModel(model);
+ cachedPropertyModels.put(p.getURI(), cachedModel);
+ }
}
+ return cachedModel;
}
/**
More information about the MOBY-guts
mailing list