Search in sources :

Example 1 with PropertyFunctionFactory

use of org.apache.jena.sparql.pfunction.PropertyFunctionFactory in project jena by apache.

the class PathLib method install.

/** Install a path as a property function in a given registry */
public static void install(String uri, final Path path, PropertyFunctionRegistry registry) {
    PropertyFunctionFactory pathPropFuncFactory = (u) -> new PathPropertyFunction(path);
    registry.put(uri, pathPropFuncFactory);
}
Also used : Context(org.apache.jena.sparql.util.Context) Binding(org.apache.jena.sparql.engine.binding.Binding) ARQInternalErrorException(org.apache.jena.sparql.ARQInternalErrorException) BasicPattern(org.apache.jena.sparql.core.BasicPattern) QueryIterConcat(org.apache.jena.sparql.engine.iterator.QueryIterConcat) TriplePath(org.apache.jena.sparql.core.TriplePath) OpPath(org.apache.jena.sparql.algebra.op.OpPath) OpSequence(org.apache.jena.sparql.algebra.op.OpSequence) Graph(org.apache.jena.graph.Graph) ArrayList(java.util.ArrayList) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) QueryIterYieldN(org.apache.jena.sparql.engine.iterator.QueryIterYieldN) Op(org.apache.jena.sparql.algebra.Op) GraphUtils(org.apache.jena.sparql.util.graph.GraphUtils) Iter(org.apache.jena.atlas.iterator.Iter) ExecutionContext(org.apache.jena.sparql.engine.ExecutionContext) BindingFactory(org.apache.jena.sparql.engine.binding.BindingFactory) PathEval(org.apache.jena.sparql.path.eval.PathEval) Iterator(java.util.Iterator) Predicate(java.util.function.Predicate) Triple(org.apache.jena.graph.Triple) QueryIterPlainWrapper(org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper) PropertyFunctionFactory(org.apache.jena.sparql.pfunction.PropertyFunctionFactory) PathBlock(org.apache.jena.sparql.core.PathBlock) Objects(java.util.Objects) List(java.util.List) Explain(org.apache.jena.sparql.mgt.Explain) Var(org.apache.jena.sparql.core.Var) Node(org.apache.jena.graph.Node) OpBGP(org.apache.jena.sparql.algebra.op.OpBGP) PropertyFunctionRegistry(org.apache.jena.sparql.pfunction.PropertyFunctionRegistry) PropertyFunctionFactory(org.apache.jena.sparql.pfunction.PropertyFunctionFactory)

Example 2 with PropertyFunctionFactory

use of org.apache.jena.sparql.pfunction.PropertyFunctionFactory in project jena by apache.

the class TextQuery method init.

public static void init() {
    if (initialized)
        return;
    synchronized (lock) {
        if (initialized) {
            JenaSystem.logLifecycle("TextQuery.init - skip");
            return;
        }
        initialized = true;
        JenaSystem.logLifecycle("TextQuery.init - start");
        TextAssembler.init();
        SystemInfo sysInfo = new SystemInfo(IRI, PATH, VERSION, BUILD_DATE);
        SystemARQ.registerSubSystem(sysInfo);
        PropertyFunctionRegistry.get().put("http://jena.apache.org/text#query", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new TextQueryPF();
            }
        });
        JenaSystem.logLifecycle("TextQuery.init - finish");
    }
}
Also used : PropertyFunction(org.apache.jena.sparql.pfunction.PropertyFunction) SystemInfo(org.apache.jena.sparql.mgt.SystemInfo) PropertyFunctionFactory(org.apache.jena.sparql.pfunction.PropertyFunctionFactory)

Example 3 with PropertyFunctionFactory

use of org.apache.jena.sparql.pfunction.PropertyFunctionFactory in project jena by apache.

the class SpatialQuery method init.

public static void init() {
    if (initialized)
        return;
    synchronized (lock) {
        if (initialized) {
            JenaSystem.logLifecycle("SpatialQuery.init - skip");
            return;
        }
        initialized = true;
        JenaSystem.logLifecycle("SpatialQuery.init - start");
        SpatialAssembler.init();
        SystemInfo sysInfo = new SystemInfo(IRI, PATH, VERSION, BUILD_DATE);
        SystemARQ.registerSubSystem(sysInfo);
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#withinCircle", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new IsWithinCirclePF();
            }
        });
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#nearby", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new IsNearByPF();
            }
        });
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#withinBox", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new IsWithinBoxPF();
            }
        });
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#intersectBox", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new IntersectsBoxPF();
            }
        });
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#north", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new NorthPF();
            }
        });
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#south", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new SouthPF();
            }
        });
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#east", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new EastPF();
            }
        });
        PropertyFunctionRegistry.get().put("http://jena.apache.org/spatial#west", new PropertyFunctionFactory() {

            @Override
            public PropertyFunction create(String uri) {
                return new WestPF();
            }
        });
        JenaSystem.logLifecycle("SpatialQuery.init - finish");
    }
}
Also used : SystemInfo(org.apache.jena.sparql.mgt.SystemInfo) PropertyFunctionFactory(org.apache.jena.sparql.pfunction.PropertyFunctionFactory) PropertyFunction(org.apache.jena.sparql.pfunction.PropertyFunction)

Aggregations

PropertyFunctionFactory (org.apache.jena.sparql.pfunction.PropertyFunctionFactory)3 SystemInfo (org.apache.jena.sparql.mgt.SystemInfo)2 PropertyFunction (org.apache.jena.sparql.pfunction.PropertyFunction)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Objects (java.util.Objects)1 Predicate (java.util.function.Predicate)1 Iter (org.apache.jena.atlas.iterator.Iter)1 Graph (org.apache.jena.graph.Graph)1 Node (org.apache.jena.graph.Node)1 Triple (org.apache.jena.graph.Triple)1 ARQInternalErrorException (org.apache.jena.sparql.ARQInternalErrorException)1 Op (org.apache.jena.sparql.algebra.Op)1 OpBGP (org.apache.jena.sparql.algebra.op.OpBGP)1 OpPath (org.apache.jena.sparql.algebra.op.OpPath)1 OpSequence (org.apache.jena.sparql.algebra.op.OpSequence)1 BasicPattern (org.apache.jena.sparql.core.BasicPattern)1 PathBlock (org.apache.jena.sparql.core.PathBlock)1 TriplePath (org.apache.jena.sparql.core.TriplePath)1