Search in sources :

Example 96 with URI

use of org.openrdf.model.URI in project gocd by gocd.

the class SesameGraph method getSesameNativeProperty.

URI getSesameNativeProperty(RDFProperty predicate) {
    if (!sesameNativeTypeByRDFProperty.containsKey(predicate)) {
        String predicateURIText = predicate.getURIText();
        URI predicateURI = conn.getValueFactory().createURI(predicateURIText);
        sesameNativeTypeByRDFProperty.put(predicate, predicateURI);
    }
    return sesameNativeTypeByRDFProperty.get(predicate);
}
Also used : URI(org.openrdf.model.URI)

Example 97 with URI

use of org.openrdf.model.URI in project gocd by gocd.

the class SesameGraph method remove.

public void remove(Resource tripleSubject, RDFProperty triplePredicate, Integer integer) {
    AbstractSesameResource sesameSubject = (AbstractSesameResource) tripleSubject;
    URI sesameNativePredicate = getSesameNativeProperty(triplePredicate);
    try {
        conn.remove(sesameSubject.getSesameNativeResource(), sesameNativePredicate, conn.getValueFactory().createLiteral(String.valueOf(integer), XMLSchema.INTEGER), contextResource);
    } catch (RepositoryException e) {
        throw new ShineRuntimeException(e);
    }
}
Also used : ShineRuntimeException(com.thoughtworks.studios.shine.ShineRuntimeException) RepositoryException(org.openrdf.repository.RepositoryException) URI(org.openrdf.model.URI)

Example 98 with URI

use of org.openrdf.model.URI in project gocd by gocd.

the class SesameGraph method addStatement.

public void addStatement(Resource subject, RDFProperty predicate, String object) {
    AbstractSesameResource sesameSubject = (AbstractSesameResource) subject;
    URI sesameNativePredicate = getSesameNativeProperty(predicate);
    try {
        conn.add(sesameSubject.getSesameNativeResource(), sesameNativePredicate, conn.getValueFactory().createLiteral(String.valueOf(object), XMLSchema.STRING), contextResource);
    } catch (RepositoryException e) {
        throw new ShineRuntimeException("Could not add statement << [" + subject + "] [" + predicate + "] [" + object + "] >>", e);
    }
}
Also used : ShineRuntimeException(com.thoughtworks.studios.shine.ShineRuntimeException) RepositoryException(org.openrdf.repository.RepositoryException) URI(org.openrdf.model.URI)

Example 99 with URI

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

the class VCMetaDataMiriamManager method getStoredCrossReferencedLinks.

public List<URL> getStoredCrossReferencedLinks(MiriamResource miriamResource) throws MalformedURLException {
    URI resource = vcMetaData.getRdfData().getValueFactory().createURI(miriamResource.getMiriamURN());
    Iterator<Statement> iter = vcMetaData.getRdfData().match(resource, MIRIAM.BioProperties.isDescribedBy, null);
    List<URL> urlList = new ArrayList<URL>();
    while (iter.hasNext()) {
        Statement statement = iter.next();
        URL url = new URL(statement.getObject().toString());
        urlList.add(url);
    }
    return urlList;
}
Also used : Statement(org.openrdf.model.Statement) ArrayList(java.util.ArrayList) URI(org.openrdf.model.URI) URL(java.net.URL)

Example 100 with URI

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

the class SBPAX3Util method addMeasurableSubEntity.

public static URI addMeasurableSubEntity(Graph model, String uri, Resource parent, Resource sbTerm, double value, Resource unit) {
    URI measurable = model.getValueFactory().createURI(uri);
    model.add(measurable, RDF.TYPE, SBPAX3.SBMeasurable);
    model.add(measurable, SBPAX3.sbTerm, sbTerm);
    model.add(measurable, SBPAX3.hasNumber, model.getValueFactory().createLiteral(value));
    model.add(measurable, SBPAX3.hasUnit, unit);
    model.add(parent, SBPAX3.sbSubEntity, measurable);
    return measurable;
}
Also used : URI(org.openrdf.model.URI)

Aggregations

URI (org.openrdf.model.URI)111 Test (org.junit.Test)28 SailConnection (org.openrdf.sail.SailConnection)25 Value (org.openrdf.model.Value)22 Statement (org.openrdf.model.Statement)21 NotifyingSailConnection (org.openrdf.sail.NotifyingSailConnection)21 Resource (org.openrdf.model.Resource)20 Literal (org.openrdf.model.Literal)14 ValueFactory (org.openrdf.model.ValueFactory)12 RepositoryException (org.openrdf.repository.RepositoryException)11 SailException (org.openrdf.sail.SailException)10 ShineRuntimeException (com.thoughtworks.studios.shine.ShineRuntimeException)8 Vertex (com.tinkerpop.blueprints.Vertex)7 HashSet (java.util.HashSet)7 Representation (org.apache.stanbol.entityhub.servicesapi.model.Representation)7 Model (org.openrdf.model.Model)7 URIImpl (org.openrdf.model.impl.URIImpl)7 Edge (com.tinkerpop.blueprints.Edge)6 BNode (org.openrdf.model.BNode)6 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)6