ParseCancellationException: null - for SMS2

I am getting this error:

ERROR 2019-08-06 15:42:39,841 [stardog-user-18] com.stardog.http.server.undertow.ErrorHandling:writeError(138): Unexpected error on the server
org.antlr.v4.runtime.misc.ParseCancellationException: null
at org.antlr.v4.runtime.BailErrorStrategy.recoverInline(BailErrorStrategy.java:90) ~[antlr4-runtime-4.5.1.jar:4.5.1]
at org.antlr.v4.runtime.Parser.match(Parser.java:229) ~[antlr4-runtime-4.5.1.jar:4.5.1]

Hi Radu,

Can you share the SMS2 mapping that is producing this error?

I wish I could - but can't - too much to obfuscate

Went back to https://www.stardog.com/docs/#_stardog_mapping_syntax_2 as a starting point.

One challenge for me is that keys in mongodb contain spaces - I believe they need to be replaced with underscore and ... a bit more tricky.

I hope I am not trail blazing this area... I am pretty sure I am not

My example below. It works but I don't understand why it works.

The json document in mongodb

movie1 = {
   "name of movie":"Unforgiven",
   "genre":["Drama", "Western"],
   "boxOffice":101157447,
   "description":"Retired gunslinger reluctantly takes on one last job.",
   "director":[
      {"director":"clintEastwood", "name":"Clint Eastwood"}
   ],
   "actor":[
      {"actor":"morganFreeman", "name":"Morgan Freeman"},
      {"actor":"clintEastwood", "name":"Clint Eastwood"},
      {"actor":"geneHackman", "name":"Gene Hackman"}
   ]
}

and the mapping

PREFIX : <http://stardog.com/movies/>
MAPPING <urn:movies>
FROM GraphQL {
  movie {
    movieId: _id
    name: name_of_movie
    genre @array
    boxOffice
    description
    director @array {
        directorId: director
        directorName: name
    }
    actor @array {
        actorId: actor
        actorName: name
    }
  }
}
TO {
  ?movie a :Movie ;
    :name ?name ;
    :genre ?genre ;
    :boxOffice "?boxOffice"^^xsd:integer ;
    :description ?description ;
    :directed ?directedMovie ;
    :actedIn ?actedInMovie .

  ?directedMovie a :DirectedMovie ;
    :director ?director ;
    :name ?directorName .

  ?director a :Person .

  ?actedInMovie a :ActedInMovie ;
    :actor ?actor ;
    :name ?actorName .

  ?actor a :Person .
}
WHERE {
  BIND (template("http://stardog.com/movies/Job_{movieId}_{directorId}") AS ?directedMovie)
  BIND (template("http://stardog.com/movies/Job_{movieId}_{actorId}") AS ?actedInMovie)
  BIND (template("http://stardog.com/movies/Title_{movieId}") AS ?movie)
  BIND (template("http://stardog.com/movies/Name_{directorId}") AS ?director)
  BIND (template("http://stardog.com/movies/Name_{actorId}") AS ?actor)
}

Nope it actually doesn't work - in my sparql query - id don't see any tripple whose object is "Unforgiven" - that is the movie name.

PREFIX : <http://stardog.com/movies/>

SELECT * {
   GRAPH <virtual://movies> {
      ?s ?p ?o
   }
}

So how do I solve the problem of spaces in keys?

I set up a graph using your data and mappings and was able to run your query with no errors.

Can you give a more complete description of the error, including the whatever errors are in the log file?

Thanks,
-Paul

Paul this is all i get when I run $ kubectl logs stardog-5fb54cfc9c-zhr9q

OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Index format is obsolete, manual migration is required: /var/opt/stardog/system

Hi Daryl,

Welcome to the community.

Your question got posted to an existing thread and I'm afraid it might not get the same level of attention. Could you repost it as a new topic?

Cheers,
-Paul

Paul,

Indeed no errors - but no movie name in sparql result either. When I change the JSON key to be like:

movie1 = {
   "name_of_movie":"Unforgiven",

I get the movie name in the search results.

  • How can we represent spaces in JSON keys in the SMS2 mapping GraphQL?

Please address it since it is very important.

Regards,
Radu

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.