construct workflow ttl from sparql endpoint

46 views
Skip to first unread message

Tim Bridwell

unread,
Oct 3, 2024, 5:07:54 AM10/3/24
to TopBraid Suite Users
Looking to use TB 7.8 sparql endpoint to construct a ttl file from .tch for inserting into another .tch file for a different environment (ex. dev to test).

I am able to build an satisfactory CONSTRUCT query, and get the data I need. However, in the data are duplicate blank node triples:

<urn:x-change:2024-10-02T19-47-36.847Zm149843-17f82ce1-07a8-427d-8492-10a87eb28814>
        rdf:type          teamwork:Change;
        rdfs:comment      "Created Article \"test\"";
        dcterms:created   "2024-10-02T19:47:36.847Z"^^xsd:dateTime;
        sioc:has_creator  <urn:x-tb-users:xxxxx>;
        teamwork:added    [] ;
        teamwork:added    [ teamwork:object     <#Article>;
                            teamwork:predicate  rdf:type;
                            teamwork:subject    <#test>
                          ];
teamwork:added    [ teamwork:object     <#Article>;
                            teamwork:predicate  rdf:type;
                            teamwork:subject    <#test>
                          ];
teamwork:added    [ teamwork:object     <#Article>;
                            teamwork:predicate  rdf:type;
                            teamwork:subject    <#test>
                          ];
teamwork:added    [ teamwork:object     <#Article>;
                            teamwork:predicate  rdf:type;
                            teamwork:subject    <#test>
                          ];
etc.

Other than the duplicates, the remainder ttl is exactly what I need for an INSERT DATA query.

Construct query:

CONSTRUCT { ?s ?a ?o .
  ?s teamwork:tag      <urn:x-tags:xxx> .
    ?s ?p [ teamwork:object ?y ;
     teamwork:predicate ?b ;
      teamwork:subject ?d ] . }
WHERE {
  ?s teamwork:tag      <urn:x-tags:xxx> .
  ?s ?a ?o .
  ?s ?p [teamwork:object ?y ;
     teamwork:predicate ?b ;
     teamwork:subject ?d] .
}

Holger Knublauch

unread,
Oct 3, 2024, 5:12:35 AM10/3/24
to 'Luis Enrique Ramos García' via TopBraid Suite Users
Hi Tim,
my understanding is that this would produce multiple blank nodes for each match of the triple ?s ?a ?o.

Can be break this into two separate CONSTRUCTs where you first do all other triples including the ?a and then the loop over the subject/predicate/object bnodes?

Another strategy may be to reuse the blank nodes, i.e. avoid using [ ... ] syntax in the CONSTRUCT clause, as that would produce fresh bnodes each time. Instead try

?s ?p ?t .
?t teamwork:subject ?d .
?t teamwork:predicate ?b .
?t teamwork:object ?y .

and then use ?t in the CONSTRUCT.

(These are just some untested ideas, HTH).

Holger



--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.com
---
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-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/d4abdeee-363a-459b-b995-332b32bf01c5n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages