Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[smila-user] Attributes and annotations

I'm having trouble adding a simple attribute and annotation during
tests (extension of DeclarativeServiceTestCase):

final Id id = createBlackboardRecord("source", "item");
Path p = new Path("Lyrics");
final Literal literal = getBlackboard().createLiteral(id);
literal.setStringValue("my lyrics value");
getBlackboard().setLiteral(id, p, literal);
Annotation ann = blackboard.createAnnotation(id);
ann.addAnonValue("emotion value");
blackboard.addAnnotation(id, p, "Emotion", ann);

causes:
java.lang.NullPointerException
	at org.eclipse.smila.blackboard.impl.TransientBlackboardImpl.addAnnotation(TransientBlackboardImpl.java:518)
	at it.polimi.chansonnier.processing.EmotionProcessingService.process(EmotionProcessingService.java:29)
	at it.polimi.chansonnier.core.test.EmotionProcessingServiceTest.testAnnotatesTextWithTheEmotionFound(EmotionProcessingServiceTest.java:24)
        ...
It seems that getAnnotableObject() returns null when it finds the
Lyrics attribute, because attribute.getObjects() is empty. But it
*must* be empty, I have not subattributes in this attribute nor I can
add metadata objects since the blackboard has only Literal-oriented
methods. Maybe I can only create attributes with the record and not
via addition of literals? I just want to add the annotation to this
attribute.

-- 
Giorgio Sironi
Piccolo Principe & Web Engineer
http://giorgiosironi.blogspot.com
http://twitter.com/giorgiosironi


Back to the top