New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with avg. untyped String literal length measure #60

Closed
LorenzBuehmann opened this Issue Jul 2, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@LorenzBuehmann
Copy link
Member

LorenzBuehmann commented Jul 2, 2018

def AvgUntypedStringLength(triples: RDD[Triple]): Double = {
val typed_strngs = triples.filter(triple => (triple.getObject.isLiteral() && triple.getObject.getLiteralDatatypeURI.isEmpty()))
val lenth_o = typed_strngs.map(_.getObject.toString().length()).sum()
val cnt = typed_strngs.count()
if (cnt > 0) lenth_o / cnt else 0
}

this code will not work because since RDF 1.1 - which is default mode in Apache Jena - every literal has a datatype. Previous untyped literals (aka plain literals) now do have the datatype rdf:langString. That's also the reason why in the unit test it always returns 0.0 although the data contains e.g.

<http://example.org/show/218> <http://example.org/show/localName> "That Seventies Show"@en . # literal with a language tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment