Feature/14 fix rdfxml parserserializer to pass w3c test#249
Conversation
…e `factory.createLiteral("flargh", xsd:integer)`
…problemes de sonar
|
remiceres
left a comment
There was a problem hiding this comment.
Overall the changes look good. I’ve left a few comments that should be addressed before merging, but nothing major. Once those are fixed, it will be ready to go.
| ctx.predicateStack.pop(); | ||
|
|
||
| if (RDFXMLUtils.isDescription(localName, uri) || RDFXMLUtils.isRdfNodeElementType(uri, localName)) { | ||
| if (!ctx.subjectStack.isEmpty()) { |
There was a problem hiding this comment.
Merge this if statement with the enclosing one
| public class RDFXMLParser extends AbstractRDFParser { | ||
|
|
||
| /** RDF/XML format identifier for this parser. */ | ||
| private final RDFFormat format = RDFFormat.RDFXML; |
There was a problem hiding this comment.
Make this final field static too
| @@ -144,20 +161,34 @@ private void handleCharacters(char[] ch, int start, int length) { | |||
| characters.append(ch, start, length); | |||
There was a problem hiding this comment.
Move this method into "RdfXmlSaxHandler"
| * and special parseType attributes, updating the parsing context accordingly. | ||
| */ | ||
| private void handleStartElement(String uri, String localName, String qName, Attributes attrs) { | ||
| private void handleStartElement(String uri, String localName, String qName, Attributes attrs) |
There was a problem hiding this comment.
Move this method into "RdfXmlSaxHandler"
| } | ||
| return Optional.empty(); | ||
|
|
||
| switch (localName) { |
There was a problem hiding this comment.
Add a default case to this switch
| case "nodeID": | ||
| case "datatype": | ||
| case "aboutEach": | ||
| case "aboutEachPrefix": |
There was a problem hiding this comment.
Merge the previous cases into this one using comma-separated label
| case "datatype": | ||
| case "Description": | ||
| case "aboutEach": | ||
| case "aboutEachPrefix": |
There was a problem hiding this comment.
Merge the previous cases into this one using comma-separated label
| } | ||
|
|
||
| // According to RDF/XML spec section 5.1 | ||
| switch (localName) { |
There was a problem hiding this comment.
Add a default case to this switch
| switch (parseType) { | ||
| case "Resource": | ||
| case "Literal": | ||
| case "Collection": |
There was a problem hiding this comment.
Merge the previous cases into this one using comma-separated label.
There was a problem hiding this comment.
| case "Collection": | |
| case "Resource", "Literal", "Collection": | |
| return; // Valid |
|
|
|
| throw new ParsingErrorException("rdf:nodeID value '" + nodeID + "' is not a valid NCName. " + | ||
| "NCNames cannot contain colons and must start with a letter or underscore."); | ||
| } | ||
| return factory.createBNode(ParserConstants.BLANK_NODE_PREFIX + nodeID); |
There was a problem hiding this comment.
Use static access with "fr.inria.corese.core.next.impl.io.common.IOConstants" for "BLANK_NODE_PREFIX".
| switch (parseType) { | ||
| case "Resource": | ||
| case "Literal": | ||
| case "Collection": |
There was a problem hiding this comment.
| case "Collection": | |
| case "Resource", "Literal", "Collection": | |
| return; // Valid |
|
No description provided.