stanfordnlp/CoreNLP · error · RuntimeException

not implemented!

Error message

not implemented!

What it means

OpenIEParser.parse(SemanticGraph) is deliberately unimplemented and throws RuntimeException("not implemented!") at src/edu/stanford/nlp/scenegraph/OpenIEParser.java:28. OpenIE-based scene graph parsing only supports parsing from a full Annotation; the SemanticGraph overload exists solely to satisfy the abstract base class.

Solutions

  1. Build a CoreNLP Annotation (with tokenize/ssplit/pos/lemma/depparse/OpenIE pipeline) and call parse(annotation) instead.
  2. Use a parser implementation that supports SemanticGraph input if a graph is all you have.
  3. Wrap OpenIEParser behind an adapter that accepts SemanticGraph but throws a clearer error or converts input.

Example fix

// before
SceneGraph g = openIEParser.parse(sg); // throws
// after
Annotation ann = new Annotation(text);
pipeline.annotate(ann); // full CoreNLP pipeline
SceneGraph g = openIEParser.parse(ann);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(input instanceof Annotation)) throw new IllegalArgumentException("OpenIEParser only accepts Annotation");

Type guard

boolean isOpenIECapableInput(Object o) { return o instanceof Annotation; }

Try / catch

try {
  return parser.parse(input);
} catch (RuntimeException e) {
  if (e.getMessage().contains("not implemented")) throw new UnsupportedOperationException("Use parse(Annotation) with OpenIEParser");
  throw e;
}

Prevention

When it happens

Trigger: Calling parse(sg) on an OpenIEParser instance with a SemanticGraph — e.g. reusing code written for the dependency-based parser instead of calling parse(Annotation).

Common situations: Migrating from Dcoref/dependency parsers to OpenIEParser while keeping the SemanticGraph call site; generic benchmark harnesses that dispatch on the SemanticGraph overload.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/35ff8969c9c5c091. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/scenegraph/OpenIEParser.java:28

import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.semgraph.SemanticGraph;
import edu.stanford.nlp.util.CoreMap;

public class OpenIEParser extends AbstractSceneGraphParser {


  public OpenIEParser() {
    Properties props = new Properties();
    props.setProperty("annotators", "tokenize,ssplit,parse,depparse,lemma,ner,dcoref,natlog,openie");
    props.setProperty("depparse.model", "/Users/sebschu/Dropbox/Uni/RA/VisualGenome/parser-models/run0.gz");
    props.setProperty("depparse.extradependencies", "MAXIMAL");
    this.pipeline = new StanfordCoreNLP(props);
  }

  @Override
  public SceneGraph parse(SemanticGraph sg) {
   throw new RuntimeException("not implemented!");
  }

  @Override
  public SceneGraph parse(Annotation annotation) {

    SceneGraph sg = new SceneGraph();

    /*for (CoreMap sentence : annotation.get(CoreAnnotations.SentencesAnnotation.class)) {
      for (RelationTriple extraction : sentence.get(NaturalLogicAnnotations.RelationTriplesAnnotation.class)) {


        String[] subjParts = extraction.subjectGloss().split(" ");
        String[] objParts = extraction.objectGloss().split(" ");
        String subj = extraction.subjectHead().toString(OutputFormat.VALUE_INDEX);
        String obj = extraction.objectHead().toString(OutputFormat.VALUE_INDEX);

        String pred = extraction.relationLemmaGloss();

View on GitHub (pinned to 1b7edd19c4)