-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The shape topology to Mermaid #29
Comments
@pietercolpaert Can you explain how it fits in the extractor? What is the function description and input parameters? |
import {CBDShapeExtractor} from "extract-cbd-shape"; This will create the shape topology already. the shapesGraphStore is an rdf-stores RDFStore containing all quads of the shape let extractor = new CBDShapeExtractor(shapesGraphStore); This now has something of type ShapesGraph in it, in which I’d like to add a toMermaid function that takes the term of the nodeshape as a parameter extractor.shapesGraph.toMermaid(df.namedNode('nodeshapeIRI')); |
@pietercolpaert How would you convert something like this shape to Mermaid? ex:Shape a sh:NodeShape ;
sh:property [
sh:path ex:subject ;
sh:minCount 1 ;
sh:node [
sh:property [
sh:path rdfs:label ;
sh:minCount 1
]
]
] . When it's converted to a Shape topology it has both {
"requiredPaths": [
{
"predicate": {
"termType": "NamedNode",
"value": "http://example.org/subject"
}
}
],
"nodeLinks": [
{
"pathPattern": {
"predicate": {
"termType": "NamedNode",
"value": "http://example.org/subject"
}
},
"link": {
"termType": "BlankNode",
"value": "n3-39"
}
}
],
"atLeastOneLists": [],
"optionalPaths": [],
"closed": false
} |
A nodelink path is also going to be repeated in either the optional or in the required path indeed. So I’d say if a path is already processed as part of a nodelink, let’s ignore it in the optional/required, unless we will also visualize required vs. optional in a different way, i.e. by using a dashed line instead of a full line? I.e., for optional node links, this then would become:
Imagine the foaf:member’s subject is an organization, that if given, must have an rdfs:label, we can show it as follows: flowchart TD
S(( ))---X{OR}
X---S1(( ))
X---S2(( ))
S1-->|gsp:geo|S3[ ]-->|"asWKT | asGML"|S4[ ]
S5(( ))-.->|^foaf:member|S1
S1-->|foaf:knows|S6[ ]
S5-->|rdfs:label|S7[ ]
|
Ok! I included that. Another question: how do we deal with double inverse paths? ex:DoubleInversePathShape a sh:NodeShape ;
sh:closed true;
sh:property [
sh:path ([sh:inversePath [sh:inversePath ex:p1 ] ]) ;
sh:minCount 1
] . Do we just invert the first inverse path and leave the second as is (which is what happens now) or do we keep inverting them until we can't anymore? P.S. I don't fully understand why someone would use a double inverse path in the first place 😄 |
I believe we should turn it around again indeed: double inverse becomes forward |
Closed by #30 |
It would be useful to be able to export the shape topology as a mermaid description.
I.e., the shape topology
Could be translated to this in mermaid:
Visualizing into:
The text was updated successfully, but these errors were encountered: