On 15 May 2018 at 14:02, Holger Knublauch <[email protected]
<mailto:[email protected]>> 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]
<mailto:[email protected]>> 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(<http://surroundaustralia.com/app/crips/domain/>
<http://surroundaustralia.com/app/crips/domain/>>;) }\">
<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(<http://surroundaustralia.com/app/crips/domain/>
<http://surroundaustralia.com/app/crips/domain/>>;) }\">
<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(<http://surroundaustralia.com/app/crips/domain/>
<http://surroundaustralia.com/app/crips/domain/>>;) }\">
<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(<http://surroundaustralia.com/app/crips/domain/>
<http://surroundaustralia.com/app/crips/domain/>>;) }\">
<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(<http://surroundaustralia.com/app/crips/domain/>
<http://surroundaustralia.com/app/crips/domain/>>;) }\">
<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]
<mailto:[email protected]>.
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
<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
<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
<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.