Search in sources :

Example 41 with Statement

use of org.openrdf.model.Statement in project blueprints by tinkerpop.

the class PropertyGraphSailConnection method vertexPropertiesWithKey.

private StatementGenerator<Vertex> vertexPropertiesWithKey(final String key, final URI pred) {
    return new StatementGenerator<Vertex>() {

        public void generate(Vertex source, Collection<Statement> results) {
            Object o = source.getProperty(key);
            if (null != o) {
                Literal object = toLiteral(o);
                if (null != object) {
                    Statement s = context.valueFactory.createStatement(uriForVertex(source), pred, object);
                    results.add(s);
                }
            }
        }
    };
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) Statement(org.openrdf.model.Statement) Literal(org.openrdf.model.Literal) Collection(java.util.Collection)

Example 42 with Statement

use of org.openrdf.model.Statement in project blueprints by tinkerpop.

the class PropertyGraphSailConnection method generateIdStatement.

private void generateIdStatement(final Element e, final URI uri, final Collection<Statement> results) {
    Statement s = context.valueFactory.createStatement(uri, PropertyGraphSail.ID, toLiteral(e.getId()));
    results.add(s);
}
Also used : Statement(org.openrdf.model.Statement)

Example 43 with Statement

use of org.openrdf.model.Statement in project blueprints by tinkerpop.

the class PropertyGraphSailConnection method generateLabelStatement.

private void generateLabelStatement(final Edge e, final URI uri, final Collection<Statement> results) {
    Statement s = context.valueFactory.createStatement(uri, PropertyGraphSail.LABEL, context.valueFactory.createLiteral(e.getLabel()));
    results.add(s);
}
Also used : Statement(org.openrdf.model.Statement)

Example 44 with Statement

use of org.openrdf.model.Statement in project blueprints by tinkerpop.

the class PropertyGraphSailConnection method edgePropertiesWithKey.

private StatementGenerator<Edge> edgePropertiesWithKey(final String key, final URI pred) {
    return new StatementGenerator<Edge>() {

        public void generate(Edge source, Collection<Statement> results) {
            Object o = source.getProperty(key);
            if (null != o) {
                Literal object = toLiteral(o);
                if (null != object) {
                    Statement s = context.valueFactory.createStatement(uriForEdge(source), pred, object);
                    results.add(s);
                }
            }
        }
    };
}
Also used : Statement(org.openrdf.model.Statement) Literal(org.openrdf.model.Literal) Collection(java.util.Collection) Edge(com.tinkerpop.blueprints.Edge)

Example 45 with Statement

use of org.openrdf.model.Statement in project blueprints by tinkerpop.

the class PropertyGraphSailConnection method edgePropertiesWithKeyAndValue.

private StatementGenerator<Edge> edgePropertiesWithKeyAndValue(final String key, final URI pred, final Object value, final Literal object) {
    return new StatementGenerator<Edge>() {

        public void generate(Edge source, Collection<Statement> results) {
            Object o = source.getProperty(key);
            if (null != o && o.equals(value)) {
                Statement s = context.valueFactory.createStatement(uriForEdge(source), pred, object);
                results.add(s);
            }
        }
    };
}
Also used : Statement(org.openrdf.model.Statement) Collection(java.util.Collection) Edge(com.tinkerpop.blueprints.Edge)

Aggregations

Statement (org.openrdf.model.Statement)67 Resource (org.openrdf.model.Resource)22 Value (org.openrdf.model.Value)22 URI (org.openrdf.model.URI)21 HashSet (java.util.HashSet)16 SailException (org.openrdf.sail.SailException)10 Collection (java.util.Collection)9 Literal (org.openrdf.model.Literal)9 Graph (org.openrdf.model.Graph)7 Edge (com.tinkerpop.blueprints.Edge)6 Test (org.junit.Test)6 Vertex (com.tinkerpop.blueprints.Vertex)5 HashMap (java.util.HashMap)5 Map (java.util.Map)4 PrintWriter (java.io.PrintWriter)3 Set (java.util.Set)3 BNode (org.openrdf.model.BNode)3 ValueFactory (org.openrdf.model.ValueFactory)3 RDFHandlerException (org.openrdf.rio.RDFHandlerException)3 RdfXmlSerializer (org.qi4j.library.rdf.serializer.RdfXmlSerializer)3