[MOBY-guts] biomoby commit
Gary Schiltz
gss at pub.open-bio.org
Mon Mar 21 21:32:38 UTC 2005
gss
Mon Mar 21 16:32:38 EST 2005
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser
In directory pub.open-bio.org:/tmp/cvs-serv8465/src/org/semanticmoby/parser
Modified Files:
Parser.java
Log Message:
Fixed to use new org.semanticmoby.graph.* signatures
moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser Parser.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser/Parser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser/Parser.java 2004/11/23 00:18:46 1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser/Parser.java 2005/03/21 21:32:38 1.2
@@ -5,17 +5,16 @@
import java.util.*;
import org.semanticmoby.graph.*;
-import org.semanticmoby.parser.*;
-import org.semanticmoby.tools.ModelRetriever;
-import org.semanticmoby.tools.Util;
+import org.semanticmoby.tools.*;
import org.semanticmoby.vocabulary.*;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.*;
/**
- * This class is used to parse OWL models, stored as Jena2 models, into
- * objects that implement interfaces from the org.semanticmoby.graph package.
+ * This class is used to parse RDF models, stored as Jena2 models, into
+ * objects that implement interfaces from the org.semanticmoby.graph
+ * package.
*/
public class Parser
{
@@ -186,7 +185,7 @@
// Create and return an unordered collection of the parsed providers
//
- return new MOBYUnorderedCollection(null, providers, null);
+ return new MOBYUnorderedCollection(providers, null, null);
}
/**
@@ -199,9 +198,9 @@
// First parse the scalar properties name, oneLineDescription, and aboutURI
//
- String name = getDataPropertyValue(provider, MOBY.name);
- String oneLiner = getDataPropertyValue(provider, MOBY.oneLineDescription);
- String aboutURI = getDataPropertyValue(provider, MOBY.aboutURI);
+ Statement nameStmt = model.getProperty(provider, MOBY.name);
+ Statement oneLineDescriptionStmt = model.getProperty(provider, MOBY.oneLineDescription);
+ Statement aboutURIStmt = model.getProperty(provider, MOBY.aboutURI);
// A provider can have multiple operatesOn properties, each of
// which leads to a subgraph. Parse each of these subgraphs.
@@ -219,8 +218,8 @@
// oneLineDescription, aboutURI, and collection of operatesOn subgraphs
//
return new MOBYProvider(
- provider, name, oneLiner, aboutURI,
- new MOBYUnorderedCollection(provider, operatesOn, model),
+ provider, nameStmt, oneLineDescriptionStmt, aboutURIStmt,
+ new MOBYUnorderedCollection(operatesOn, provider, model),
model);
}
@@ -326,16 +325,16 @@
// Create and return a Subject to describe this hasMapping subgraph
//
return new MOBYSubject(res,
- new MOBYFixedCollection(res, statements, model),
- new MOBYUnorderedCollection(res, directMappings, model),
+ new MOBYFixedCollection(statements, res, model),
+ new MOBYUnorderedCollection(directMappings, res, model),
collectionFor(res, nestedMappings),
model);
}
/**
- * Parse the object of a mapsTo statement, which should be a
- * Subject, a data structure, or both. If the object is a data
+ * Parse the object of a mapsTo statement, which should be an
+ * Object, a data structure, or both. If the object is a data
* structure, then each element of the data structure should
* be a mapped subgraph.
*/
@@ -370,7 +369,7 @@
//
Model model = res.getModel();
return new MOBYObject(res,
- new MOBYFixedCollection(res, statements, model),
+ new MOBYFixedCollection(statements, res, model),
collectionFor(res, nested), model);
}
@@ -462,12 +461,6 @@
model.contains(p, RDFS.subPropertyOf, MOBY.Property);
}
- private String getDataPropertyValue(Resource subject, Property property)
- {
- Statement s = subject.getModel().getProperty(subject, property);
- return (s == null) ? null : s.getObject().toString();
- }
-
private Resource getResourcePropertyValue(Resource subject, Property property)
{
Statement s = subject.getModel().getProperty(subject, property);
@@ -500,13 +493,13 @@
private MOBYCollection collectionFor(Resource res, List elements)
{
if (isList(res)) {
- return new MOBYFixedCollection(res, elements, res.getModel());
+ return new MOBYFixedCollection(elements, res, res.getModel());
} else if (isBag(res)) {
- return new MOBYUnorderedCollection(res, elements, res.getModel());
+ return new MOBYUnorderedCollection(elements, res, res.getModel());
} else if (isSeq(res)) {
- return new MOBYOrderedCollection(res, elements, res.getModel());
+ return new MOBYOrderedCollection(elements, res, res.getModel());
} else if (isAlt(res)) {
- return new MOBYEnumeration(res, elements, res.getModel());
+ return new MOBYEnumeration(elements, res, res.getModel());
} else {
return null;
}
More information about the MOBY-guts
mailing list