On Feb 12, 2021, at 12:38 PM, Dan Segal <dan.seg...@gmail.com> wrote:Is it possible to dynamically create a new instance based on a query result?
For example, let's say that we assert:?s ?p ?oWe would then want to dynamically create a new instance ?s1 with a graph such as:?s1 ?p1 ?oI have tried a query such as the following, but this does not work without the variable ?s1 being declared in the WHERE clause:INSERT {?s1 a class1;?p1 ?o}WHERE{?s a class;?p ?o}
Constructs a new URI resource by inserting the existing variable bindings into a template. The template can mention variable names in curly braces, such as "my:Instance-{?index}" would create "my:Instance-42" is ?index has the value 42. As an alternative to variable names, the function can take additional arguments after the template, the variables of which can be accessed using {?1}, {?2} etc. For example: smf:buildURI("my:Instance-{?1}-{?2}", ?day, ?month) would insert day and month at places {?1} and {?2}.
| sp:arg1 (xsd:string): The URI template such as "<http://my.com/Instance-{?index}>". If the template contains a full URI, then it must be wrapped by <...>, otherwise the system will treat it as a qname. |
A variation of smf:buildURI that also makes sure that the created URI is unique in the current graph (that is, no triple contains the URI as either subject, predicate or object). This function is particularly useful for ontology mapping from a legacy data source into an RDF model.
| sp:arg1 (xsd:string): The URI template such as "<http://my.com/Instance-{?index}>". If the template contains a full URI, then it must be wrapped by <...>, otherwise the system will treat it as a qname. |
INSERT {GRAPH <urn:this_graph>{?s1 a class1;?p1 ?o}}WHERE{?s a class;?p ?o}Is there a way to create these new ?s1 instances automatically based on the query conditions?Thank you!Dan
--
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/e7312fa7-ee09-41e1-a69f-692dbdefba49n%40googlegroups.com.
I have tried a query such as the following, but this does not work without the variable ?s1 being declared in the WHERE clause:
INSERT {
?s1 a class1;
?p1 ?o
}
WHERE
{?s a class;
?p ?o}