Multiple classes in Virtual Graph

Hi

I'm using Stardog Virtual Graph cloud version connecting via MongoDB for . I would like to create one class by table iteration. I´m using the mapping below:

prefix network:<synthetic_network:>

MAPPING urn:mapping_nodes
FROM JSON {
"synthetic_nodes":{
"Node": "?Node",
}
}
TO {
?synthetic_nodes a network:Nodes;
rdfs:label ?Node.

?single a owl:Class ;
rdfs:label ?NodeName .

?synthetic_nodes a?single ;
rdfs:label ?NodeName .

<< ?synthetic_nodes a network:Nodes >> a ?single;
rdfs:label ?NodeName .
}
WHERE {
BIND(template("synthetic_network:Node:{Node}") AS ?synthetic_nodes)
BIND(template("synthetic_network:Node_{Node}") AS ?single)
BIND(template("Node_{Node}") AS ?NodeName)
}

The mapping is saved and it's working for first class, network:Nodes, where all iteratios of the source table are well mapped

My second definition, "single", it's not working, I´'m trying to dynamically create one class for each iteration in source table, something like Node_0, Node_1, Node_2 ... and so on, but it´s not working.

Third and four option are not working as well

How can create classes dinamicaly using Virtual Graph?

Hi Ramon,

The ?single a owl:Class ; pattern will not have any effect on reasoning. It will create the triple but the reasoner takes its schema from the local Stardog database only.

The << ?synthetic_nodes a network:Nodes >> a ?single; is an edge property, which should work as long as edge properties (edge.properties) are enabled for the database you are querying.

The template here contains a relative IRI (no colon) so it will be prepended with the base IRI for this VG. We recommend against this. Please use an string for an absolute IRI in the prefix.

IIUC, what you want is the third group of triples:

?synthetic_nodes a ?single ;

Is that triple not being created? In what way is it not working?

-Paul

Hi Paul

Thank you for your advices

At the end I tried a different and easy approach just creating one class for all iterations and one relationship with itself. The key is to use same syntax that used to define Nodes (despite use string or colon for IRI)

MAPPING urn:mapping_edges
FROM JSON {
"synthetic_edges":{
"Source": "?Source",
"Target": "?Target"
}
}
TO { ?domain network:conectedWith ?range }
WHERE{
BIND(template("synthetic_network:Node:{Source}") AS ?domain)
BIND(template("synthetic_network:Node:{Target}") AS ?range)
}

note: ticket can be closed