Search in sources :

Example 26 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class NamespaceAssimilator method smelt.

public Resource smelt(Graph rdf, Resource resource) {
    Resource resourceMapped = resource;
    if (!resources.contains(resource)) {
        if (resource instanceof URI) {
            URI uri = (URI) resource;
            if (!namespace.equals(uri.getNamespace())) {
                resourceMapped = resourceMap.get(resource);
                if (resourceMapped == null) {
                    String localName = uri.getLocalName();
                    String localNameNew = localName;
                    resourceMapped = rdf.getValueFactory().createURI(namespace + localNameNew);
                    resourceMap.put(resource, resourceMapped);
                }
            }
        } else {
            resourceMapped = resourceMap.get(resource);
            if (resourceMapped == null) {
                resourceMapped = resource;
            }
        }
    }
    return resourceMapped;
}
Also used : Resource(org.openrdf.model.Resource) URI(org.openrdf.model.URI)

Example 27 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class IndexedGraph method removeFromAllMaps.

protected void removeFromAllMaps(Statement statement) {
    Resource subject = statement.getSubject();
    URI predicate = statement.getPredicate();
    Value object = statement.getObject();
    removeFromMap(sMap, subject, statement);
    removeFromMap(pMap, predicate, statement);
    removeFromMap(oMap, object, statement);
    removeFromMap(spMap, new ListOfTwo<Value>(subject, predicate), statement);
    removeFromMap(soMap, new ListOfTwo<Value>(subject, object), statement);
    removeFromMap(poMap, new ListOfTwo<Value>(predicate, object), statement);
}
Also used : Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) URI(org.openrdf.model.URI)

Example 28 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class IndexedGraph method addToAllMaps.

protected void addToAllMaps(Statement statement) {
    Resource subject = statement.getSubject();
    URI predicate = statement.getPredicate();
    Value object = statement.getObject();
    addToMap(sMap, subject, statement);
    addToMap(pMap, predicate, statement);
    addToMap(oMap, object, statement);
    addToMap(spMap, new ListOfTwo<Value>(subject, predicate), statement);
    addToMap(soMap, new ListOfTwo<Value>(subject, object), statement);
    addToMap(poMap, new ListOfTwo<Value>(predicate, object), statement);
}
Also used : Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) URI(org.openrdf.model.URI)

Example 29 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class SBPAX3Util method addMichaelisMentenKineticsKmKcat.

public static void addMichaelisMentenKineticsKmKcat(Graph model, String NS, Resource catalysis, String index, double kM, double kCat) {
    URI kinetics = model.getValueFactory().createURI(NS + "kinetics" + index);
    model.add(kinetics, RDF.TYPE, SBPAX3.SBState);
    Resource michaelisMentenKinetics = SBPAX3Util.addSBTerm(model, NS + "michaelisMentenKinetics", "Henri-Michaelis-Menten rate law", "0000029");
    model.add(kinetics, SBPAX3.sbTerm, michaelisMentenKinetics);
    model.add(catalysis, SBPAX3.sbSubEntity, kinetics);
    Resource michaelisSubstrateConcentration = SBPAX3Util.addSBTerm(model, NS + "michaelisSubstrateConcentration", "Michaelis constant for substrate", "0000322", "MetaCyc", "Km");
    SBPAX3Util.addMeasurableSubEntity(model, NS + "kM" + index, kinetics, michaelisSubstrateConcentration, kM, UOMEList.MolePerMilligram);
    Resource catalyticRateConstant = SBPAX3Util.addSBTerm(model, NS + "catalyticRateConstant", "catalytic rate constant", "0000025", "MetaCyc", "kcat");
    SBPAX3Util.addMeasurableSubEntity(model, NS + "kCat" + index, kinetics, catalyticRateConstant, kCat, UOMEList.PerSecond);
}
Also used : Resource(org.openrdf.model.Resource) URI(org.openrdf.model.URI)

Example 30 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class OntologyInfo method resourcesFromStatement.

public static Set<Resource> resourcesFromStatement(Statement statement) {
    Resource subject = statement.getSubject();
    URI predicate = statement.getPredicate();
    Value object = statement.getObject();
    if (object instanceof Resource) {
        return new SetOfThree<Resource>(subject, predicate, (Resource) object);
    } else {
        return new SetOfTwo<Resource>(subject, predicate);
    }
}
Also used : SetOfTwo(org.sbpax.util.sets.SetOfTwo) SetOfThree(org.sbpax.util.sets.SetOfThree) Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) URI(org.openrdf.model.URI)

Aggregations

Resource (org.openrdf.model.Resource)60 Statement (org.openrdf.model.Statement)22 URI (org.openrdf.model.URI)20 Value (org.openrdf.model.Value)17 HashSet (java.util.HashSet)14 Graph (org.openrdf.model.Graph)7 Literal (org.openrdf.model.Literal)6 SailConnection (org.openrdf.sail.SailConnection)5 SailException (org.openrdf.sail.SailException)5 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 NotifyingSailConnection (org.openrdf.sail.NotifyingSailConnection)4 Map (java.util.Map)3 Set (java.util.Set)3 Element (org.jdom.Element)3 HashGraph (org.sbpax.impl.HashGraph)3 VCID (cbit.vcell.biomodel.meta.VCID)2 Registry (cbit.vcell.biomodel.meta.registry.Registry)2 Edge (com.tinkerpop.blueprints.Edge)2