RangeError: Maximum call stack size exceeded
Closed this issue · 7 comments
I'm working with Ontodia javascript library to present my graphdb rdf data set.
There's this error I couldnt find the cause of it, which happens onload:
RangeError: Maximum call stack size exceeded.
This function is exactly as the DOCS describes you should connect to your sparql endpoint.
function onWorkspaceMounted(workspace) {
if (!workspace) {
return;
}
workspace.getModel().importLayout({
dataProvider: new SparqlDataProvider(
{
endpointUrl: REACT_APP_API_URL + "/sparql/query",
imagePropertyUris: ["http://xmlns.com/foaf/0.1/img"],
queryMethod: SparqlQueryMethod.GET,
queryFunction: ontodiaQueryFunction
},
OWLStatsSettings
)
});
}
I have the feeling something is not valid with the response I get from ...queryFunction: ontodiaQueryFunction
, and Ontodia might have a problem dealing with it, but that's just a guess. Though I did log the resolved promise of ontodiaQueryFuncion
to see I get a legit response, and it does look legit.
Did you run into a similar issue? or familiar with this error?
Hi. It is highly possible the problem with cycles in the class-tree panel. I think we will fix this issue, but for now the only way is to correct class structure, by removing cycles. I mean it's related with a part of SPARQL dataProvider which constructs class tree.
@Ladone3
Can you elaborate on that?
What exactly do you mean by removing cycles?
- Is it something I should do on my graph?
- Is it something I need to do with the object I pass into
SparqlDataProvider
?
The interesting thing is that I used to have Ontodia running perfectly.
And suddenly it started to break, so I wonder if it happens because of changes we did to our graph?
For example we have several classes:
example:A a owl:Class .
example:B a owl:Class .
And then we have next relations beetwen them:
example:A rdfs:subClassOf example:B .
example:B rdfs:subClassOf example:A .
This combination of relations is what I mean talking about cycles. But the situation can be more comlex. For example when we have longer way between A and B:
example:A rdfs:subClassOf example:B .
example:B rdfs:subClassOf example:A1 .
example:A1 rdfs:subClassOf example:A2 .
example:A2 rdfs:subClassOf example:A3 .
example:A3 rdfs:subClassOf example: A .
Of course in some cases because of the algorithm of selecting root elements for the class tree you don't have this problem, because if there is no other links on elements of the cycle we just don't take this cycle into account, but in most cases it leads to the error.
Probably in your case it was exactly this way. There were no links to the elements of some cycle and then the new one was created, and since than you have this error.
Ohh I see
Do you think there's a workaround for this?
@AlexeyMz said OWLRDFSSettings
might work for me.
workspace.getModel().importLayout({
dataProvider: new SparqlDataProvider(
{
endpointUrl: REACT_APP_API_URL + "/sparql/query",
imagePropertyUris: ["http://xmlns.com/foaf/0.1/img"],
queryMethod: SparqlQueryMethod.GET,
queryFunction: ontodiaQueryFunction
},
OWLRDFSSettings // here
)
});
}
Though it didnt. Am I missing something with OWLRDFSSettings
configuration?
@udielenberg Sorry, using OWLRDFSSettings
won't work unfortunately.
But I think there is another workaround instead. It's possible to override settings object with custom class tree query to explicitly filter out relations that are causing the issue:
const providerSettings = {
...OWLStatsSettings,
classTreeQuery: `
SELECT ?class ?instcount ?label ?parent
WHERE {
{
SELECT ?class (count(?inst) as ?instcount) WHERE {
?inst rdf:type ?class.
FILTER ISIRI(?class)
} GROUP BY ?class
}
UNION { ?class rdf:type rdfs:Class }
UNION { ?class rdf:type owl:Class }
OPTIONAL { ?class rdfs:label ?label }
OPTIONAL {
?class rdfs:subClassOf ?parent.
FILTER ISIRI(?parent)
# Here explicitly filter triples that form class cycles
MINUS { example:A rdfs:subClassOf example:B }
}
}
`
};
workspace.getModel().importLayout({
dataProvider: new SparqlDataProvider({...}, providerSettings),
});
@AlexeyMz
Thanks a lot
Fixed in v0.9.9