From the source code, line 202 is failing if the file cannot be resolved to a valid path. It's the same problem as before. Could you try it with the same output file as the test case, to reduce the number of unknowns that I cannot see?

Holger


On 15/05/2018 15:54, Rob Atkinson wrote:

Well - i get a different error if the path root is invalid - so what is "GuessLang" and how do I make it behave? (What is a "mismatch" in this context?)

test case indeed worked with SWP preferences on - but perhaps this vital context ought to be visible in the help on SWP, and come up when you search "TestCases" in help!


On Tuesday, 15 May 2018 15:37:28 UTC+10, Holger Knublauch wrote:



    On 15/05/2018 14:18, Rob Atkinson wrote:
    Great - this is the sort of context that would be really helpful
    linked from any doc fragment that mentions files !

    Anyway - no luck with the path yet:

    Caused by: java.lang.NullPointerException
    at org.topbraid.core.io.IO.guessLang(IO.java:202)
    at
    org.topbraid.sparqlmotion.EclipseWorkspace.save(EclipseWorkspace.java:114)
    at
    
org.topbraid.spin.swp.engine.control.internal.DumpGraphControlElement.run(DumpGraphControlElement.java:35)

    using

    <ui:setContext ui:queryGraph=\"{=
    ui:graphWithImports(&lt;http://surroundaustralia.com/app/crips/domain/&gt
    <http://surroundaustralia.com/app/crips/domain/&gt>;) }\">
        <sml:ImportXMLFile sml:ignoreDoctype="true"
    sm:outputVariable=\"xml\"
    sml:sourceFilePath=\"/TQ_models/test0.1/AgentModelsXML/{=
    ?fileName }\">
            <sml:ConvertXMLToRDF
    sml:baseURI=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\
    <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C>"
    sml:replace=\"{= true }\" sml:xml=\"{= ?xml }\">
            <ui:update ui:updateQuery="{! INSERT { GRAPH ui:tempGraph
    { ?s ?p ?o } } WHERE { ?s ?p ?o } }" />

               </sml:ConvertXMLToRDF>
        </sml:ImportXMLFile>
        <ui:dumpGraph ui:graph="{= ui:tempGraph }"
    ui:filePath="/TQ_models/test0.1/agentmodels_as_sxml.ttl" />
    </ui:setContext>

    as you can see the project where the file comes from is the same
    as the target .....

    Hmm. I don't see a possible problem other than a mismatch of
    files. I would need to get a more complete picture to try to
    reproduce this on my machine...


    - so went back to try your example...

    and when i added the test case to the example.org
    <http://example.org> project, then tried to access it according
    to this:

    Test Cases
    TopBraid Composer > SHACL Support
    
<http://127.0.0.1:52621/help/ntopic/org.topbraidcomposer.core/html/SHACL.htm>


          Test Cases

    TopBraid Composer includes a capability to create and execute
    test cases that verify the correct definition of SHACL
    
<http://127.0.0.1:52621/help/ntopic/org.topbraidcomposer.core/html/TestCases.htm?resultof=%22%74%65%73%74%63%61%73%65%22%20%22%74%65%73%74%63%61%73%22%20#SHACL.htm>
    shapes and functions. In order to use this feature, create a new
    SHACL file containing |.test.| in its file name. The easiest way
    to do that is to use the *File > New > RDF Test Cases File*
    wizard. Test files must import the DASH library, and may import
    other namespaces containing definitions you want to test.

    no test cases show up in the view when looking at this file...
    .. if i run it shows up in the results and claims success
    ... no file "out.ttl" appears in example.org <http://example.org>
    project  (even after refresh)

    I just verified it works with 5.5 but don't forget to activate
    Debug mode in Preferences > TopBraid Composer > SWP

    Holger








    On 15 May 2018 at 14:02, Holger Knublauch <[email protected]
    <javascript:>> wrote:



        On 15/05/2018 13:49, Rob Atkinson wrote:
        Thanks Holger,

        its difficult to keep track - but are sometimes path names
        are relative to projects or are they always absolute? but i
        see the clue was in the doc /exampleProject!

        this raise a couple of other questions:
        1) in a production EDG environment where we want to ingest
        files programmatically, without the TBC project environment
        being present, how are such pathnames interpreted?

        TBC is not needed for production but the Eclipse workspace
        will also be used in an EDG/TBL environment.

          for example, I can see if we do a "one-shot" upload and
        process that this works:

        |_fileUpload|   If|true|then files uploaded as part of a
        multi-part HTTP request will be copied into the workspace as
        temporary files. The name of the corresponding file will be
        assigned to the argument variable. For example, define a
        service with an argument arg:file of type string and create
        a web form that uploads files as "file". The variable ?file
        will then contain the path to the temp file in the
        workspace. You can then use the function|smf:baseURI|to get
        the URI of that file, e.g. to open it using|<ui:setContext
        ui:queryGraph="..." />|. This is particularly useful for
        Excel files.


        what if we wanted to retain the files - they are not
        "temporary" and we may want to use them later, or if we, for
        example, wanted to go back and try re-processing a file, how
        would we know how to find it - is there any way for example
        to look at a directory and see the files.

        If you don't use _fileUpload, XML files will become plain
        string values that you can save to anywhere, e.g. using
        sml:ExportToXMLfile. Then use the magic property tops:files
        as in ?path tops:files ("/myproject.org/files/xml
        <http://myproject.org/files/xml>" false) to iterate through a
        folder of your choice.



        2) is there a way to get the current project context, or
        look up a project's local choice of path using some
        metadata, or set a base context for file paths to be
        interpreted? We already have a situation where the eclipse
        import for different people have a different root because
        some of us are looking at a single project, others have
        opened a directory containing multiple projects, and the
        scripts not longer work :-(

        To be completely flexible, and to discover available files
        and folders dynamically, use tops:files as above. Another
        approach would be to parameterize the execution using some
        kind of config file, for example a dedicated namespace that
        holds local settings, and that is expected to be present in
        each installation.

        Holger




        rob









        On 15 May 2018 at 13:19, Holger Knublauch
        <[email protected] <javascript:>> wrote:

            Hi Rob,

            ui:dumpGraph requires a graph URI, so the solutions with
            one of the temporary unnamed graphs would not work (as
            you have found out). However, using ui:tempGraph does
            work as confirmed in the attached test case.

            The error handling with ui:tempGraph is not ideal (and I
            have just added a better message for the next release),
            but what the null pointer means is that it cannot
            resolve the path in your workspace.

            In your case, /tmp/agentmodels_as_sxml.ttl, is there a
            project called "tmp" in your TopBraid/Eclipse workspace?
            It needs to, e.g. if you had a project "example.org
            <http://example.org>" then use /example.org/file.ttl
            <http://example.org/file.ttl>".

            If there is a different null pointer in your case, could
            you send me the stack trace?

            Thanks,
            Holger




            On 15/05/2018 10:56, Rob Atkinson wrote:
            OK - so I want to try using SPINMap to transform what
            default import looks like into the target ontology...

            so I'm trying to save the imported graph
            programmatically, because I'm still not sure if manual
            import gives the exact same graph as import using the
            sml:ImportXML - and AFAICT SPINMap needs a project file
            to load for it its UI based mapping processes

            - so, load and save example, set up SPINMap, invoke
            transformation using SWP for multiple files in the same
            XML schema...

            tried various things to dump the graph : (NB invoking
            with &_contextdebug=true)

            If none of these work, noting the graph loads (JSON
            print out example provided by Holger works), then what
            will work and what is wrong with these options?


            <ui:setContext ui:queryGraph=\"{=
            
ui:graphWithImports(&lt;http://surroundaustralia.com/app/crips/domain/&gt
            <http://surroundaustralia.com/app/crips/domain/&gt>;) }\">
            <sml:ImportXMLFile sml:ignoreDoctype="true"
            sm:outputVariable=\"xml\"
            sml:sourceFilePath=\"/TQ_models/test0.1/AgentModelsXML/{=
            ?fileName }\">
            <sml:ConvertXMLToRDF
            sml:baseURI=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\";
            <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C>
            sml:replace=\"{= true }\" sml:xml=\"{= ?xml }\">
             <ui:dumpGraph
            ui:graph=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\";
            <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C> 
ui:filePath="/tmp/agentmodels_as_sxml.ttl"
            />
             </sml:ConvertXMLToRDF>
            </sml:ImportXMLFile>

            runs with no error - but seems to dump nothing

            <ui:setContext ui:queryGraph=\"{=
            
ui:graphWithImports(&lt;http://surroundaustralia.com/app/crips/domain/&gt
            <http://surroundaustralia.com/app/crips/domain/&gt>;) }\">
            <sml:ImportXMLFile sml:ignoreDoctype="true"
            sm:outputVariable=\"xml\"
            sml:sourceFilePath=\"/TQ_models/test0.1/AgentModelsXML/{=
            ?fileName }\">
            <sml:ConvertXMLToRDF
            sml:baseURI=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\";
            <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C>
            sml:replace=\"{= true }\" sml:xml=\"{= ?xml }\">
            </sml:ConvertXMLToRDF>
            </sml:ImportXMLFile>
            <ui:dumpGraph
            ui:graph=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\";
            <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C> 
ui:filePath="/tmp/agentmodels_as_sxml.ttl"
            />
            runs with no error - but seems to dump nothing


            <ui:setContext ui:queryGraph=\"{=
            
ui:graphWithImports(&lt;http://surroundaustralia.com/app/crips/domain/&gt
            <http://surroundaustralia.com/app/crips/domain/&gt>;) }\">
            <sml:ImportXMLFile sml:ignoreDoctype="true"
            sm:outputVariable=\"xml\"
            sml:sourceFilePath=\"/TQ_models/test0.1/AgentModelsXML/{=
            ?fileName }\">
            <sml:ConvertXMLToRDF
            sml:baseURI=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\";
            <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C>
            sml:replace=\"{= true }\" sml:xml=\"{= ?xml }\">
             <ui:dumpGraph ui:graph="{= ui:tempGraph }"
            ui:filePath="/tmp/agentmodels_as_sxml.ttl" />
             </sml:ConvertXMLToRDF>
            </sml:ImportXMLFile>

            Gives a null pointer

            <ui:setContext ui:queryGraph=\"{=
            
ui:graphWithImports(&lt;http://surroundaustralia.com/app/crips/domain/&gt
            <http://surroundaustralia.com/app/crips/domain/&gt>;) }\">
            <sml:ImportXMLFile sml:ignoreDoctype="true"
            sm:outputVariable=\"xml\"
            sml:sourceFilePath=\"/TQ_models/test0.1/AgentModelsXML/{=
            ?fileName }\">
            <sml:ConvertXMLToRDF
            sml:baseURI=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\";
            <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C>
            sml:replace=\"{= true }\" sml:xml=\"{= ?xml }\">
            <ui:update ui:updateQuery="{! INSERT { GRAPH
            ui:tempGraph { ?s ?p ?o } } WHERE { ?s ?p ?o } }" />
            <ui:dumpGraph ui:graph="{= ui:tempGraph }"
            ui:filePath="/tmp/agentmodels_as_sxml.ttl" />
             </sml:ConvertXMLToRDF>
            </sml:ImportXMLFile>

            Gives a null pointer

            <ui:setContext ui:queryGraph=\"{=
            
ui:graphWithImports(&lt;http://surroundaustralia.com/app/crips/domain/&gt
            <http://surroundaustralia.com/app/crips/domain/&gt>;) }\">
            <sml:ImportXMLFile sml:ignoreDoctype="true"
            sm:outputVariable=\"xml\"
            sml:sourceFilePath=\"/TQ_models/test0.1/AgentModelsXML/{=
            ?fileName }\">
            <sml:ConvertXMLToRDF
            sml:baseURI=\"http://surroundaustralia.com/app/crips/tmp/am_sxml/\";
            <http://surroundaustralia.com/app/crips/tmp/am_sxml/%5C>
            sml:replace=\"{= true }\" sml:xml=\"{= ?xml }\">

             </sml:ConvertXMLToRDF>
            </sml:ImportXMLFile>
            <ui:dumpGraph ui:graph="{= ui:tempGraph }"
            ui:filePath="/tmp/agentmodels_as_sxml.ttl" />
            Gives a null pointer
-- 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] <javascript:>.
            For more options, visit
            https://groups.google.com/d/optout
            <https://groups.google.com/d/optout>.

-- 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] <javascript:>.
            For more options, visit
            https://groups.google.com/d/optout
            <https://groups.google.com/d/optout>.


-- 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]
        <javascript:>.
        For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.

-- 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]
        <javascript:>.
        For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.


-- 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] <javascript:>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
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 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