Skip navigation.
Home
Semantic Software Lab
Concordia University
Montréal, Canada

Having problem with mapping domain entities using OwlExporter

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

Hi,

Currently, I'm doing Ontology Population using OwlExporter. I copy all the jape grammar from OwlExporter and apply to my application. Now I'm trying to map the entities. But I found some errors. The errors detail as below:

java.lang.NullPointerException
at
japeactionclasses.mention_map_domain_entitiesmention_map_domain_entitiesActionClass401.doit(japeactionclasses.mention_map_domain_entitiesmention_map_domain_entitiesActionClass401:58) at gate.jape.RightHandSide.transduce(RightHandSide.java:369)
at gate.jape.SinglePhaseTransducer.fireRule(SinglePhaseTransducer.java:660)
at gate.jape.SinglePhaseTransducer.transduce(SinglePhaseTransducer.java:325)
at gate.jape.MultiPhaseTransducer.transduce(MultiPhaseTransducer.java:183)
at gate.jape.Batch.transduce(Batch.java:204)
at gate.creole.Transducer.execute(Transducer.java:162)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.creole.SerialController.runComponent(SerialController.java:221)
at gate.creole.SerialController.executeImpl(SerialController.java:153)
at gate.creole.SerialAnalyserController.executeImpl(SerialAnalyserController.java:125)
at gate.creole.AbstractController.execute(AbstractController.java:75)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.gui.SerialControllerEditor$RunAction$1.run(SerialControllerEditor.java:1619)
at java.lang.Thread.run(Thread.java:744)

I'm not understand the syntax error. Can u please help me to identify the problem above? I really appreciate if u can guide me to understand the syntax error and what is the potential solution for this problem.

Many thanks

Sincerely
Tihah

rene's picture

GATE/OwlExporter version?

Hello Tihah,

We need some more information: Which version of GATE and OwlExporter are you using?

When does this error occur? E.g., did you run the example ontology population pipeline?

Best, René

GATE version

Hi Rene,

The GATE version is GATE 7.1 and for OwlExporter I use from GATE plug-in. At the 1st time I use GATE I have run the OwlExporter. It works properly. And now I'm trying to adapt it into my application. When i compile my jape grammar the error above appear. Here is my example of jape grammar. Kindly please check the coding. Many thanks.

Phase: mention_map_domain_entities
Input: Document Sentence Lookup
Options: control = all debug = true

Rule: mention_map_domain_entitiesRule
(
{Lookup}
)
:ann
-->
{
try {
AnnotationSet as = (gate.AnnotationSet)bindings.get("ann");
Annotation ann = (gate.Annotation)as.iterator().next();
FeatureMap features = ann.getFeatures();

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("person_name") == 0) {
features.put("className", "Person");
features.put("representedCountry", ann.getFeatures().get("minorType").toString());
}

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("factor") == 0) {
features.put("className", "Factor");
features.put("factor_of", ann.getFeatures().get("minorType").toString());
}

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("event") == 0) {
features.put("className", "Event");
features.put("location", ann.getFeatures().get("minorType").toString());
}

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("belligerent") == 0) {
String s = ann.getFeatures().get("minorType").toString();
features.put("className", Character.toUpperCase(s.charAt(0)) + s.substring(1));
}

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("person") == 0) {
String s = ann.getFeatures().get("minorType").toString();
features.put("className", Character.toUpperCase(s.charAt(0)) + s.substring(1));
}

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("spatial_thing") == 0) {
String s = ann.getFeatures().get("minorType").toString();
features.put("className", Character.toUpperCase(s.charAt(0)) + s.substring(1));
}

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("intangible") == 0) {
String s = ann.getFeatures().get("minorType").toString();
features.put("className", Character.toUpperCase(s.charAt(0)) + s.substring(1));
}

if(ann.getFeatures().get("majorType").toString().compareToIgnoreCase("person_name") == 0 ||
ann.getFeatures().get("majorType").toString().compareToIgnoreCase("belligerent") == 0 ||
ann.getFeatures().get("majorType").toString().compareToIgnoreCase("person") == 0 ||
ann.getFeatures().get("majorType").toString().compareToIgnoreCase("event") == 0 ||
ann.getFeatures().get("majorType").toString().compareToIgnoreCase("spatial_thing") == 0 ||
ann.getFeatures().get("majorType").toString().compareToIgnoreCase("intangible") == 0 ||
ann.getFeatures().get("majorType").toString().compareToIgnoreCase("factor") == 0)
{
String in = doc.getContent().getContent(
ann.getStartNode().getOffset(), ann.getEndNode().getOffset()).toString();
features.put("instanceName", in);
features.put("representationId", ann.getId());
features.put("corefChain", null);
features.put("kind", "Class");
outputAS.add(as.firstNode(), as.lastNode(), "OwlExportClassDomain", features);

}

}
catch(Exception e){
e.printStackTrace();
}
}

Tihah

rene's picture

Try finding an example sentence

Hi Tihah,

My recommendation to problems like this is to find a small text fragment (e.g., one sentence) where your grammar fails. This will help you isolate the part where your Java RHS code runs into an error because of a missing annotation or feature.

Best, René

Thanks Rene for your

Thanks Rene for your suggestion. It worked :)

Tihah