org.apache.jena.query.QueryVisitor Java Examples

The following examples show how to use org.apache.jena.query.QueryVisitor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SPARQLExtQuery.java    From sparql-generate with Apache License 2.0 5 votes vote down vote up
/**
 * Visits the query by a SPARQLExt Query visitor, or throw an exception.
 *
 * @param visitor
 *            must be a SPARQLExt Query visitor.
 * @throws IllegalArgumentException
 *             if the query is not a SPARQLExtQuery Query.
 */
@Override
public void visit(final QueryVisitor visitor) {
	if (visitor instanceof SPARQLExtQueryVisitor) {
		visit((SPARQLExtQueryVisitor) visitor);
	} else {
		SPARQLExtQueryVisitor visitor2 = new SPARQLExtQueryVisitorDelegate(visitor);
		visit((SPARQLExtQueryVisitor) visitor2);
	}
}
 
Example #2
Source File: SPARQLExtFormatterElement.java    From sparql-generate with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(ElementSubQuery el) {
    out.print("{ ");
    out.incIndent(INDENT);
    Query q = el.getQuery();

    // Serialize with respect to the existing context
    QuerySerializerFactory factory = SerializerRegistry.get().getQuerySerializerFactory(SPARQLExt.SYNTAX);
    QueryVisitor serializer = factory.create(SPARQLExt.SYNTAX, context, out);
    q.visit(serializer);

    out.decIndent(INDENT);
    out.print("}");
}
 
Example #3
Source File: SPARQLStar.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
@Override
      public QueryVisitor create(Syntax syntax, Prologue prologue, IndentedWriter writer) {
	return wrappedFactory.create(syntax, prologue, writer);
}
 
Example #4
Source File: SPARQLStar.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
@Override
      public QueryVisitor create(Syntax syntax, SerializationContext context, IndentedWriter writer) {
	return wrappedFactory.create(syntax, context, writer);
}
 
Example #5
Source File: SPARQLExtQueryVisitorDelegate.java    From sparql-generate with Apache License 2.0 4 votes vote down vote up
public SPARQLExtQueryVisitorDelegate(QueryVisitor delegate) {
    this.delegate = delegate;
}
 
Example #6
Source File: SPARQLExt.java    From sparql-generate with Apache License 2.0 4 votes vote down vote up
@Override
public QueryVisitor create(Syntax syntax, Prologue prologue, IndentedWriter writer) {
    SerializationContext context = new SerializationContext(prologue, new NodeToLabelMapBNode("bn", false));
    return new SPARQLExtQuerySerializer(writer, context);
}
 
Example #7
Source File: SPARQLExt.java    From sparql-generate with Apache License 2.0 4 votes vote down vote up
@Override
public QueryVisitor create(Syntax syntax, SerializationContext context, IndentedWriter writer) {
    return new SPARQLExtQuerySerializer(writer, context);
}
 
Example #8
Source File: Query.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void visit(QueryVisitor visitor) {
	throw new RdfStoreException("Not supported");
}