Skip to content

Commit

Permalink
Replaces hard-coded URI by a matching between any Resource rdf:type w…
Browse files Browse the repository at this point in the history
…ith the service supported URI
  • Loading branch information
egonw committed Mar 4, 2010
1 parent dc98819 commit e06fba8
Showing 1 changed file with 18 additions and 9 deletions.
Expand Up @@ -56,9 +56,12 @@

import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.NodeIterator;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.vocabulary.RDF;

public class RDFEditor
extends EditorPart implements ISelectionListener ,
Expand Down Expand Up @@ -150,15 +153,21 @@ private IBioObject selectionToBioObject( ISelection selection ) {
for ( IExtension extension : serviceObjectExtensions ) {
for ( IConfigurationElement element
: extension.getConfigurationElements() ) {
/*
* TODO: Egon give this string the right value.
*/
String uri
= "http://www.bioclipse.net/structuredb/#Molecule";

if ( !element.getAttribute("uri").equals( uri ) ) {
continue;
}

String serviceURI = element.getAttribute("uri");

// check if this extension supports this Resource
NodeIterator iter =
model.listObjectsOfProperty(res, RDF.type);
boolean match = false;
while (iter.hasNext()) {
RDFNode node = iter.next();
if (node.isURIResource() &&
((Resource)node).getURI().equals(serviceURI))
match = true;
}

if (!match) continue;

Object service = null;
try {
Expand Down

0 comments on commit e06fba8

Please sign in to comment.