On 5/04/2017 17:48, Ilya Ushakov wrote:
Hi Holger,
Thank you for your answer.
I need to export taxonomy (both all and only separate nodes) to Turtle, RDFXML and JSON formates. I need to be able to import exported taxonomies to evn as new ones again. That's way skos:conceptScheme and skos:hasTopConcept relationships must be presented in the export result.

If i am exporting all taxonomy as is, there are no problems.
But, If i need to export only separate nodes from taxonomy (that may not connect to existing hasTopConcept relation), i need to put correct skos:hasTopConcept relation to be able to import result into evn again. For these reasons i try to modify resulting file on sml:performUpdate step.

So, using sml:ApplyConstruct, I am not able to pass resulting grapf to next steps for modifying. I am only able to pass result to the final sml:ReturnRDF step. Am I correct?

Yes. However, you could follow one sml:ApplyConstruct with another sml:ApplyConstruct, e.g.

CONSTRUCT {
    ?s ?p ?o .
}
WHERE {
    {
        ?s ?p ?o .
        FILTER (?p != skos:hasTopConcept) .
    }
    UNION
    {
        ?s skos:hasTopConcept ?old .
        BIND (skos:hasTopConcept AS ?p) .
        BIND (IRI(?nodeURI) AS ?o) .
    }
}

which will basically copy all previous triples, only replacing the objects in skos:hasTopConcept triples. (Untested)

It really depends on how complex your queries will become, and what else you need to do.

If so, what others features inside of sparqlmotion technology are suitable for my scenario?

sml:FilterByConstruct is another relevant feature.

If they don't exists, i will to rewrite on swp.

With SWP's ui:return, out of the box, we currently only support serializing Turtle back, so RDF/XML would not work.

Anyway, I think if the scenario is just about producing a graph with a few triples modified as above, I would try to put everything into a single CONSTRUCT query and wrap this into a SPIN template. Then use the SPIN template servlet to return it. The SPIN template servlet does support all three serializations that you mention.

Holger



On Tuesday, April 4, 2017 at 2:48:53 PM UTC+2, Ilya Ushakov wrote:

    Hi Everyone,
    I use evn 5.3.
    I try to write sparqlmotion script thats exports exports taxonomies.
    I need to change skos:hasTopConcept property in result set.
    For make this do next:
    1. For building resultset I use sml:ApplyConstruct with query inside:

    CONSTRUCT {
        ?a ?b ?c .
    }
    WHERE {
        {
            SELECT ?a ?b ?c
            WHERE {
                {
                    {
                        BIND (IRI(?selectedGraph) AS ?graphName) .
                        BIND (IRI(?nodeURI) AS ?taxUri) .
                        GRAPH ?graphName {
                            ?a (skos:broader)* ?taxUri .
                            ?a ?b ?c .
                        } .
                    } .
                }
                UNION
                {
                    BIND (IRI(?selectedGraph) AS ?graphName) .
                    GRAPH ?graphName {
                        ?a a skos:ConceptScheme .
                        ?a ?b ?c .
                    } .
                } .
            }
        } .
    }

    2. on the next step I try to use the sml:PerformUpdate
    2.1. In case of using next query:
    DELETE {
            ?a skos:hasTopConcept ?oldValue .
    }
    INSERT {
            ?a skos:hasTopConcept ?newValue .
    }
    WHERE {
        BIND (IRI(?nodeURI) AS ?newValue) .
        ?a ?b ?c .
        ?a skos:hasTopConcept ?oldValue .

    }
    I got NullPointerException in log
     org.topbraidlive.sparqlmotion: Exception in SPARQLMotion Servlet
    (java.lang.NullPointerException)
    org.topbraid.spin.sparqlmotion.modules.SMException:
    java.lang.NullPointerException
            at
    
org.topbraidlive.sparqlmotion.modules.performUpdate.PerformUpdateModule.execute(PerformUpdateModule.java:76)
            at
    
org.topbraid.spin.sparqlmotion.engine.impl.ExecutionEngineImpl.execute(ExecutionEngineImpl.java:203)
            at
    
org.topbraid.spin.sparqlmotion.engine.impl.ExecutionEngineImpl.executeModule(ExecutionEngineImpl.java:169)
            at
    
org.topbraid.spin.sparqlmotion.engine.impl.ExecutionEngineImpl.execute(ExecutionEngineImpl.java:119)
            at
    
org.topbraidlive.sparqlmotion.servlets.sparqlmotion.SPARQLMotionServlet.run(SPARQLMotionServlet.java:342)
            at
    
org.topbraidlive.sparqlmotion.servlets.sparqlmotion.SPARQLMotionServlet.doGet(SPARQLMotionServlet.java:249)
            at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
            at
    
org.topbraid.auth.servlet.TBAuthEnabledServlet.service(TBAuthEnabledServlet.java:41)
            at
    org.topbraid.eclipsex.servlet.TBHttpServlet.service(TBHttpServlet.java:155)
            at
    
org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
            at
    
org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyServlet.service(HttpServiceRuntimeImpl.java:1221)
            at
    
org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153)
            at
    
org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:62)
            at
    
org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:132)
            at
    
org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:100)
            at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
            at
    
org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:152)
            at
    
org.topbraidlive.servletbridge.webapplicationserver.BridgeServlet.service(BridgeServlet.java:259)eServlet.java:352)
            at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
            at
    
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)lterChain.java:207)
            at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)ava:240)
            at
    
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
            at
    
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)java:614)
            at
    
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
            at
    
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)a:88)
            at
    
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
            at
    
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)2)
            at
    
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at
    
java.lang.Thread.run(Thread.java:745)read$WrappingRunnable.run(TaskThread.java:61)
    Caused bat
    
org.topbraidlive.sparqlmotion.modules.performUpdate.PerformUpdateGraphStore.<init>(PerformUpdateGraphStore.java:105)
            at
    
org.topbraidlive.sparqlmotion.modules.performUpdate.PerformUpdateModule.execute(PerformUpdateModule.java:55))

    2.2. In case of using GRAPH keyword inside DELETE and INSERT
    accoring to descrioption of sml:PerformUpdate

    DELETE {
        GRAPH ?graphName {
            ?a skos:hasTopConcept ?oldValue .
        } .
    }
    INSERT {
        GRAPH ?graphName {
            ?a skos:hasTopConcept ?newValue .
        } .
    }
    WHERE {
        BIND (IRI(?selectedGraph) AS ?graphName) .
        BIND (IRI(?nodeURI) AS ?newValue) .
        ?a ?b ?c .
        ?a skos:hasTopConcept ?oldValue .
    }
    I got, "Unbound graph variable in sml:PerformUpdate" error message.

    org.topbraidlive.sparqlmotion: Exception in SPARQLMotion Servlet
    (Unbound graph variable in sml:PerformUpdate)
    org.topbraid.spin.sparqlmotion.modules.SMException: Unbound graph
    variable in sml:PerformUpdate
            at
    
org.topbraidlive.sparqlmotion.modules.performUpdate.PerformUpdateArgs.<init>(PerformUpdateArgs.java:52)
            at
    
org.topbraidlive.sparqlmotion.modules.performUpdate.PerformUpdateModule.execute(PerformUpdateModule.java:51)
            at
    
org.topbraid.spin.sparqlmotion.engine.impl.ExecutionEngineImpl.execute(ExecutionEngineImpl.java:203)
            at
    
org.topbraid.spin.sparqlmotion.engine.impl.ExecutionEngineImpl.executeModule(ExecutionEngineImpl.java:169)
            at
    
org.topbraid.spin.sparqlmotion.engine.impl.ExecutionEngineImpl.execute(ExecutionEngineImpl.java:119)
            at
    
org.topbraidlive.sparqlmotion.servlets.sparqlmotion.SPARQLMotionServlet.run(SPARQLMotionServlet.java:342)
            at
    
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)tionServlet.doGet(SPARQLMotionServlet.java:249)
            at
    
org.topbraid.eclipsex.servlet.TBHttpServlet.service(TBHttpServlet.java:155).java:41)
            at
    
org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyServlet.service(HttpServiceRuntimeImpl.java:1221)
            at
    
org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:62)
            at
    
org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:100)java:132)
            at
    
org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:152)
            at
    
org.topbraidlive.servletbridge.webapplicationserver.BridgeServlet.service(BridgeServlet.java:259)eServlet.java:352)
            at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
            at
    
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)lterChain.java:207)
            at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)ava:240)
            at
    
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
            at
    
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)java:614)
            at
    
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
            at
    
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)a:88)
            at
    
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
            at
    
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)2)
            at
    
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at
    
java.lang.Thread.run(Thread.java:745)read$WrappingRunnable.run(TaskThread.java:61)


    What did i wrong?

--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include the TopBraid Suite family of products and its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Group "TopBraid 
Suite Users", the topics of which include the TopBraid Suite family of products and 
its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
--- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to