On 1/07/2020 11:23, Tim Smith wrote:
Hi Holger,

In this case, I was aligning some of my ontologies with EDG ontologies, e.g. changing the inheritance hierarchies, converting some of the property shapes, etc...  I was able to accomplish what I needed by making the target graph the current graph and importing the necessary graphs for the purpose of the insert.

Overall, I've made good use of the batch operation capabilities in TBC or direct insert/delete operations to move things between graphs or change namespaces.  Ontologies are always evolving and eventually need to be refactored so moving a class and it's property shapes, etc... to another graph is a common use case.
Are you using multiple namespaces, and one namespace per graph? I am asking because that's a pattern that I have used for refactorings in the past: If a class and its shapes should have been in another graph, I first changed their namespace (prefix) and then had them written out to Sorted Turtle where it would then be easier to cut and past snippets into the target graph. Of course it would be better to skip that manual step and we could offer a "clean up by namespace" feature that moves all triples into the correct home graphs of their namespace. Would that have worked for your refactoring?
  Another common use case is to create a "mapping graph" in which I create a number of helper classes and instances to assist in mapping data sources (typically XLSX or CSV) into an ontology.  I run an insert query to create the instances (or new schema) and insert the results into a target graph.  I think I can do the same in EDG by making the target graph the current graph and import everything there,removing the imports when the insert is complete.

Yes, I guess working in the right active graph will put the triples to where they belong.

FWIW here is a new alternative approach for importing Excel and CSV (and JSON, XML etc) that may not require intermediate RDF representations: http://datashapes.org/active/import.html

Holger



TIm

On Tue, Jun 30, 2020 at 8:28 PM Holger Knublauch <hol...@topquadrant.com <mailto:hol...@topquadrant.com>> wrote:

    On 1/07/2020 06:29, Tim Smith wrote:

    Hi,

    I am refactoring an ontology and I intended to use INSERT/DELETE
    queries to make it easier.  However, when I execute the following
    query, I receive the error below:

    Is the error valid in that I cannot insert into a designated
    graph from the SPARQL query window?
    Yes, that panel is only meant for the currently active graph. That
    is the one that the user has access to and where the change
    history would be recorded. Manipulating some other graph would not
    go into the change history.
    Does this same restriction hold for the SPARQL endpoint?
    No. You can modify any graph there.
      How do I move things between graphs in EDG?

    We have some partial solutions, but only a combination of them may
    do what you need:

    - Transform tab > Copy or Move Instances from Other Asset Collection

    - Source code panel (cut/paste between two browser tabs, then save
    both)

    - SPARQL updates

    I am sure there is a lot of room for improvements here. Could you
    elaborate a bit on what type of data you are trying to move?

    Holger



    Thanks,

    Tim

    PS:  Being able to use Crtl-<Enter> to execute a query is so much
    better! Thanks for adding that in 6.4.


    *{"message":"Exception while fetching data (/sparql) : **INSERT
    can only modify the default graph *
     INSERT {
      GRAPH <urn:x-evn-master:schema_equipment> {
        ?s rdfs:subClassOf edg:Sensor .
      }
    }
    WHERE {
       ?s rdfs:subClassOf pgont:Sensor .
    }

    Error(s):

      * {"message":"Exception while fetching data (/sparql) : INSERT
        can only modify the default
        graph","locations":[{"line":2,"column":21}],"path":["sparql"]}

    Query: mutation sparqlUpdate($sparql: String!) { sparql(query:
    $sparql) report { diff results { message severity focusNode {
    label uri } path pathLabel value { label uri }
    constraintComponentName suggestions { message confidence
    applyData } } } commit(message:"Update from SPARQL Query panel",
    strict: false)}

    Variables: {"sparql":"PREFIX afn:
    <http://jena.hpl.hp.com/ARQ/function#>\nPREFIX arg:
    <http://spinrdf.org/arg#>\nPREFIX bbase:
    <http://ontologies.pg.com/businessbase#>\nPREFIX
    crosswalkprojects:
    <http://teamwork.topbraidlive.org/crosswalkprojects#>\nPREFIX
    dash: <http://datashapes.org/dash#>\nPREFIX data:
    <http://data.pg.com/data/>\nPREFIX datatype:
    <http://qudt.org/vocab/datatype/>\nPREFIX dc:
    <http://purl.org/dc/elements/1.1/>\nPREFIX dcam:
    <http://purl.org/dc/dcam/>\nPREFIX dct:
    <http://purl.org/dc/terms/>\nPREFIX dimprop:
    <http://ontologies.pg.com/dimensionandproperties#>\nPREFIX dtype:
    <http://www.linkedmodel.org/schema/dtype#>\nPREFIX edg.c:
    <http://edg.topbraid.solutions/controller/>\nPREFIX edg.glossary:
    <http://edg.topbraid.solutions/glossary/>\nPREFIX edg.sqoop:
    <http://edg.topbraid.solutions/model/sqoop/>\nPREFIX edg.v:
    <http://edg.topbraid.solutions/view/>\nPREFIX edg:
    <http://edg.topbraid.solutions/model/>\nPREFIX fn:
    <http://www.w3.org/2005/xpath-functions#>\nPREFIX foaf:
    <http://xmlns.com/foaf/0.1/>\nPREFIX gen:
    <http://ontologies.pg.com/general#>\nPREFIX geo:
    <http://www.w3.org/2003/01/geo/wgs84_pos#>\nPREFIX gr:
    <http://purl.org/goodrelations/v1#>\nPREFIX graphql:
    <http://datashapes.org/graphql#>\nPREFIX html:
    <http://uispin.org/html#>\nPREFIX metadata:
    <http://topbraid.org/metadata#>\nPREFIX ontologyprojects:
    <http://teamwork.topbraidlive.org/ontologyprojects#>\nPREFIX org:
    <http://www.w3.org/ns/org#>\nPREFIX owl:
    <http://www.w3.org/2002/07/owl#>\nPREFIX owlTime:
    <http://www.w3.org/2006/time#>\nPREFIX p1:
    <http://example.org/file1#>\nPREFIX pgont:
    <http://ontologies.pg.com/pgontology/>\nPREFIX prov:
    <http://www.w3.org/ns/prov#>\nPREFIX quantity:
    <http://qudt.org/vocab/quantity/>\nPREFIX quantitykind:
    <http://qudt.org/vocab/quantitykind/>\nPREFIX qudt-refdata:
    <http://qudt.org/vocab/refdata/>\nPREFIX qudt.type:
    <http://qudt.org/vocab/type/>\nPREFIX qudt:
    <http://qudt.org/schema/qudt/>\nPREFIX raci:
    <http://topbraid.org/raci#>\nPREFIX rdf:
    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs:
    <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX rdm:
    <http://rdm.topbraidlive.org/rdm/>\nPREFIX rdmfact:
    <http://topbraid.org/rdmfact#>\nPREFIX rdmprojects:
    <http://rdm.topbraidlive.org/rdmprojects#>\nPREFIX refdata:
    <http://ontologies.pg.com/refdata#>\nPREFIX s3:
    <http://topbraid.org/s3#>\nPREFIX search:
    <http://topbraid.org/search#>\nPREFIX sh:
    <http://www.w3.org/ns/shacl#>\nPREFIX sioc:
    <http://rdfs.org/sioc/ns#>\nPREFIX skos:
    <http://www.w3.org/2004/02/skos/core#>\nPREFIX skosxl:
    <http://www.w3.org/2008/05/skos-xl#>\nPREFIX smf:
    <http://topbraid.org/sparqlmotionfunctions#>\nPREFIX
    softwareprojects:
    <http://teamwork.topbraidlive.org/software/softwareprojects#>\nPREFIX
    sp: <http://spinrdf.org/sp#>\nPREFIX sparql:
    <http://datashapes.org/sparql#>\nPREFIX spif:
    <http://spinrdf.org/spif#>\nPREFIX spin:
    <http://spinrdf.org/spin#>\nPREFIX spl:
    <http://spinrdf.org/spl#>\nPREFIX spr:
    <http://spinrdf.org/spr#>\nPREFIX swa:
    <http://topbraid.org/swa#>\nPREFIX swash:
    <http://topbraid.org/swash#>\nPREFIX taggerprojects:
    <http://evn.topbraidlive.org/taggerprojects#>\nPREFIX taxonomies:
    <http://evn.topbraidlive.org/evnprojects#>\nPREFIX teamwork:
    <http://topbraid.org/teamwork#>\nPREFIX teamworkconstraints:
    <http://topbraid.org/teamworkconstraints#>\nPREFIX tops:
    <http://www.topbraid.org/tops#>\nPREFIX tosh:
    <http://topbraid.org/tosh#>\nPREFIX ui:
    <http://uispin.org/ui#>\nPREFIX unit:
    <http://qudt.org/vocab/unit/>\nPREFIX vaem:
    <http://www.linkedmodel.org/schema/vaem#>\nPREFIX vcard:
    <http://www.w3.org/2006/vcard/>\nPREFIX voag:
    <http://voag.linkedmodel.org/voag/>\nPREFIX vs:
    <http://www.w3.org/2003/06/sw-vocab-status/ns#>\nPREFIX wot:
    <http://xmlns.com/wot/0.1/>\nPREFIX wp:
    <http://ontologies.pg.com/v1.0/workprocess#>\nPREFIX xml:
    <http://www.w3.org/XML/1998/namespace>\nPREFIX xsd:
    <http://www.w3.org/2001/XMLSchema#>\n\nINSERT {\n GRAPH
    <urn:x-evn-master:schema_equipment> {\n ?s rdfs:subClassOf
    edg:Sensor .\n }\n}\nWHERE {\n ?s rdfs:subClassOf pgont:Sensor .
    \n}\n"}

    Service URL:
    graphql/schema_equipment/generic?message=Update_from_SPARQL_Query_panel

       Ok

-- 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 topbraid-users+unsubscr...@googlegroups.com
    <mailto:topbraid-users+unsubscr...@googlegroups.com>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/topbraid-users/CAF0WbnKb4CXbGasM1Q2j_p4tfJJuNnPZb%3Dpyn0EEO01i0MTKYw%40mail.gmail.com
    
<https://groups.google.com/d/msgid/topbraid-users/CAF0WbnKb4CXbGasM1Q2j_p4tfJJuNnPZb%3Dpyn0EEO01i0MTKYw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
-- 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 topbraid-users+unsubscr...@googlegroups.com
    <mailto:topbraid-users+unsubscr...@googlegroups.com>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/topbraid-users/1cfdc63f-d7b4-57ca-2965-56084ca9b0af%40topquadrant.com
    
<https://groups.google.com/d/msgid/topbraid-users/1cfdc63f-d7b4-57ca-2965-56084ca9b0af%40topquadrant.com?utm_medium=email&utm_source=footer>.

--
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 topbraid-users+unsubscr...@googlegroups.com <mailto:topbraid-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAF0WbnJ1cAKcp93N%3D%2B50DEOEByyPGnh8AXC2FvGjm3OQhe2j0Q%40mail.gmail.com <https://groups.google.com/d/msgid/topbraid-users/CAF0WbnJ1cAKcp93N%3D%2B50DEOEByyPGnh8AXC2FvGjm3OQhe2j0Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
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 topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/bb03681c-08c8-13ac-fc9d-6d9152a4b500%40topquadrant.com.

Reply via email to