Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c89425e
Add JSON-LD serializer implementation
remiceres Aug 29, 2025
afc821f
Integrate JSON-LD format into DefaultSerializerFactory
remiceres Aug 29, 2025
2a42ddf
Add Turtle round-trip circular tests
remiceres Aug 29, 2025
3bad778
Add N-Triples round-trip circular tests
remiceres Aug 29, 2025
19d57f5
Add N-Quads round-trip circular tests
remiceres Aug 29, 2025
95e6c79
Add TriG round-trip circular tests
remiceres Aug 29, 2025
c0cc93d
Add RDF/XML round-trip circular tests (disabled)
remiceres Aug 29, 2025
103e5e9
Add JSON-LD round-trip circular tests
remiceres Aug 29, 2025
13da733
TriG Named Graph Round-Trip Test Failures
abdessamad-abdoun Sep 1, 2025
960a629
Ajouter ANTLRTrigParser dans ParserFactory
abdessamad-abdoun Sep 3, 2025
c8e6c57
TriG Named Graph Round-Trip Test Failures
abdessamad-abdoun Sep 3, 2025
ab91a93
1 - bnode correction in serializer
prbblrypier Sep 16, 2025
fe7fc7f
1 - bnode correction in serializer
prbblrypier Sep 16, 2025
c69075e
1 - bnode correction in serializer
prbblrypier Sep 16, 2025
b17f9c5
Integrate JSON-LD format into DefaultSerializerFactory
remiceres Aug 29, 2025
00b9130
1 - bnode correction in serializer
prbblrypier Sep 16, 2025
5519f19
Fixing turtle backslash duplication in serializer
MaillPierre Sep 23, 2025
98ba4e4
fixing blank node serialization
MaillPierre Sep 30, 2025
5bf434d
fix default graph duplication
MaillPierre Sep 30, 2025
5e3190d
fixing lang tagged literal test
MaillPierre Sep 30, 2025
fb0a1c8
fix the old test that was incorrect
MaillPierre Oct 1, 2025
985272a
Integrate JSON-LD format into DefaultSerializerFactory
remiceres Aug 29, 2025
f2b2a6a
Fix Turtle and Trig parser to pass W3C
abdessamad-abdoun Sep 8, 2025
8511a7b
Fix Turtle and Trig parser to pass W3C standard test suite
abdessamad-abdoun Sep 15, 2025
4924ec3
Fix Turtle and Trig parser to pass W3C standard test suite
abdessamad-abdoun Sep 17, 2025
46257f6
Fix Turtle and Trig parser to pass W3C standard test suite
abdessamad-abdoun Sep 24, 2025
84fd969
Fix Turtle parser to pass W3C standard test suite
abdessamad-abdoun Sep 24, 2025
7a17a10
Fix Turtle parser to pass W3C standard test suite
abdessamad-abdoun Sep 26, 2025
2687fca
Fix Turtle parser to pass W3C standard test suite
abdessamad-abdoun Sep 29, 2025
a9c4401
Fix Turtle parser to pass W3C standard test suite
abdessamad-abdoun Sep 29, 2025
8595213
Fix Turtle parser to pass W3C standard test suite
abdessamad-abdoun Sep 30, 2025
44416e2
removing ignore tag
prbblrypier Sep 12, 2025
cd34614
adding qname expension for datatype uri
prbblrypier Sep 12, 2025
10b3e57
removing ignore tag
prbblrypier Sep 12, 2025
6b9f44d
adding qname expension for datatype uri
prbblrypier Sep 12, 2025
d60935e
removing ignore tag
prbblrypier Sep 12, 2025
90cb5eb
adding qname expension for datatype uri
prbblrypier Sep 12, 2025
571373c
Multi-line literals are not permitted in nquads
MaillPierre Oct 2, 2025
cc39bd9
fix: processUnicodeEscape only thows ParsingErrorException
MaillPierre Oct 2, 2025
a33dde2
fix bnode prefix in JSONLD serializer
MaillPierre Oct 27, 2025
b32499b
revue Should be configurable
abdessamad-abdoun Oct 27, 2025
ac0083b
minor fixes in XMLUtils
MaillPierre Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/main/antlr/NQuads.g4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
grammar NQuads;

nquadsDoc
: statement? (EOL* statement)* EOL*
: statement? (EOL* statement)* EOL* EOF
;

statement
Expand Down Expand Up @@ -49,8 +49,7 @@ fragment IRI_CHAR
;

STRING_LITERAL_QUOTE
: '"""' ( ~('"') | '"' ~('"') | '""' ~('"') | ECHAR | UCHAR )* '"""'
| '"' ( ~( [\u0022] | [\u005C] | [\u000A] | [\u000D] ) | ECHAR | UCHAR )* '"'
: '"' ( ~( [\u0022] | [\u005C] | [\u000A] | [\u000D] ) | ECHAR | UCHAR )* '"'
;

BLANK_NODE_LABEL
Expand Down
70 changes: 42 additions & 28 deletions src/main/antlr/TriG.g4
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ triplesOrGraph

triples2
: blankNodePropertyList predicateObjectList? '.'
| collection predicateObjectList '.'
| collection predicateObjectList? '.'
;

wrappedGraph
: '{' triplesBlock? '}'
;

triplesBlock
: triples ('.' triplesBlock?)?
: triples ('.'? triplesBlock?)?
;

labelOrSubject
Expand Down Expand Up @@ -149,7 +149,6 @@ WS
: (('\u0020' | '\u0009' | '\u000A' | '\u000D' ) )+ -> skip
;

// Terminals

Graph_w options { caseInsensitive=true; }
: 'GRAPH'
Expand All @@ -169,21 +168,22 @@ BooleanLiteral
;

IRIREF
: '<' (PN_CHARS | '.' | ':' | '#' | '@' | '%' | '&' | '$' | '!' | '\'' | '*' | '+' | '/' | '(' | ')' | '-' | ',' | '?' | '~' | UCHAR)* '>'
: '<' (PN_CHARS | '.' | ':' | '#' | '@' | '%' | '&' | '$' | '!' | '\'' | '*' | '+' | '/' | '(' | ')' | '-' | ',' | '?' | '~' | ';' | '=' | UCHAR)* '>'
;

BLANK_NODE_LABEL
: '_:' (PN_CHARS_U | [0-9] | PLX) ((PN_CHARS | '.' | PLX)* (PN_CHARS | PLX))?
;

PNAME_NS
: PN_PREFIX? ':'
: PN_PREFIX ':'
| ':'
;

PNAME_LN
: PNAME_NS PN_LOCAL
;

BLANK_NODE_LABEL
: '_:' (PN_CHARS_U | '0' .. '9') ((PN_CHARS | '.')* PN_CHARS)?
;

LANGTAG
: '@' ('a'.. 'z' | 'A' .. 'Z')+ ('-' ('a'.. 'z' | 'A' .. 'Z' | '0' .. '9')* )*
;
Expand All @@ -197,29 +197,43 @@ DECIMAL
;

DOUBLE
: ('+' | '-' )? (('0' .. '9')+ '.' ('0' .. '9')* EXPONENT
| '.' ('0' .. '9')+ EXPONENT
| ('0' .. '9')+ EXPONENT)
: ('+' | '-')? (
( ('0'..'9')+ '.' ('0'..'9')* EXPONENT )
| ( '.' ('0'..'9')+ EXPONENT )
| ( ('0'..'9')+ EXPONENT )
)
;

EXPONENT
: ('e' | 'E') ('+' | '-' )? ('0' .. '9')+
;

STRING_LITERAL_QUOTE
: '"' ((~[\u0022\u005C\u0010\u0013]) | ECHAR | UCHAR)* '"'
: '"' ((~[\u0022\u005C\u000A\u000D]) | ECHAR | UCHAR)* '"'
;

STRING_LITERAL_SINGLE_QUOTE
: '\'' ((~[\u0027\u005C\u0010\u0013]) | ECHAR | UCHAR)* '\''
: '\'' ((~[\u0027\u005C\u000A\u000D]) | ECHAR | UCHAR)* '\''
;

STRING_LITERAL_LONG_SINGLE_QUOTE
: '\'\'\'' (('\'' | '\'\'')? ( (~['\\] ) | ECHAR | UCHAR))* '\'\'\''
: '\'\'\'' (LONG_STRING_CHAR_SINGLE | ECHAR | UCHAR)* '\'\'\''
;

STRING_LITERAL_LONG_QUOTE
: '"""' (('"' | '""')? ( (~["'] ) | ECHAR | UCHAR))* '"""'
: '"""' (LONG_STRING_CHAR_DOUBLE | ECHAR | UCHAR)* '"""'
;

fragment LONG_STRING_CHAR_DOUBLE
: ~[\\"]
| '"' ~["]
| '"' '"' ~["]
;

fragment LONG_STRING_CHAR_SINGLE
: ~[\\']
| '\'' ~[']
| '\'' '\'' ~[']
;

UCHAR
Expand All @@ -236,10 +250,10 @@ WHITESPACE
;

ANON
: '[' WHITESPACE* ']'
: '[' [\u0009\u000A\u000D\u0020]* ']'
;

PN_CHARS_BASE
fragment PN_CHARS_BASE
: 'A' .. 'Z'
| 'a' .. 'z'
| '\u00C0' .. '\u00D6'
Expand All @@ -253,15 +267,15 @@ PN_CHARS_BASE
| '\u3001' .. '\uD7FF'
| '\uF900' .. '\uFDCF'
| '\uFDF0' .. '\uFFFD'
// | '\u10000' .. '\uEFFFF'
| '\u{10000}'..'\u{EFFFF}'
;

PN_CHARS_U
fragment PN_CHARS_U
: PN_CHARS_BASE
| '_'
;

PN_CHARS
fragment PN_CHARS
: PN_CHARS_U
| '-'
| [0-9]
Expand All @@ -270,28 +284,28 @@ PN_CHARS
| [\u203F-\u2040]
;

PN_PREFIX
fragment PN_PREFIX
: PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
;

PN_LOCAL
: (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
fragment PN_LOCAL
: (PN_CHARS_U | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
;

PLX
fragment PLX
: PERCENT
| PN_LOCAL_ESC
;

PERCENT
fragment PERCENT
: '%' HEX HEX
;

HEX
fragment HEX
: [0-9a-fA-F]
;

PN_LOCAL_ESC
fragment PN_LOCAL_ESC
: '\\' (
'_'
| '~'
Expand Down
49 changes: 17 additions & 32 deletions src/main/antlr/Turtle.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,9 @@
[The "BSD licence"]
Copyright (c) 2014, Alejandro Medrano (@ Universidad Politecnica de Madrid, http://www.upm.es/)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
*/
/* Derived from http://www.w3.org/TR/turtle/#sec-grammar-grammar */

// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging

grammar Turtle;

turtleDoc
Expand Down Expand Up @@ -68,6 +51,7 @@ predicate
: iri
;


object_
: iri
| BlankNode
Expand Down Expand Up @@ -130,7 +114,8 @@ string

iri
: IRIREF
| PrefixedName
| PNAME_LN
| PNAME_NS
;

BlankNode
Expand All @@ -152,27 +137,19 @@ Prefix_w options { caseInsensitive=true; }
: 'PREFIX'
;

// PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
// Prefix without the final ':'
PN_PREFIX
: PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
;

IRIREF
: '<' ((~( '\u0000' | '\u0020' | '<' | '>' | '"' | '{' | '}' | '|' | '^' | '`' |'\\' )) | UCHAR)* '>'
: '<' (~( '\u0000' | '\u0020' | '<' | '>' | '"' | '{' | '}' | '|' | '^' | '`' | '\\' ) | UCHAR)* '>'
;

// Prefix alone
PNAME_NS
: PN_PREFIX? ':'
;

PrefixedName
: PNAME_LN
| PNAME_NS
;

// Prefix + local name
PNAME_LN
: PNAME_NS PN_LOCAL
;
Expand Down Expand Up @@ -205,20 +182,28 @@ EXPONENT

// "'''" (("'" | "''")? ([^'\] | ECHAR | UCHAR))* "'''"
STRING_LITERAL_LONG_SINGLE_QUOTE
: '\'\'\'' ( ('\'' '\''? )? ( [^'\\] | ECHAR | UCHAR | '"' ) )* '\'\'\''
: '\'\'\'' (
( ~['\\] | ECHAR | UCHAR )
| '\'' ~['\\]
| '\'\'' ~['\\]
)* '\'\'\''
;

// '"""' (('"' | '""')? ([^"\] | ECHAR | UCHAR))* '"""'
STRING_LITERAL_LONG_QUOTE
: '"""' ( ('"' '"'? )? ( (~["\\]) | ECHAR | UCHAR )+ )* '"""'
: '"""' (
( ~["\\] | ECHAR | UCHAR )
| '"' ~["\\]
| '""' ~["\\]
)* '"""'
;

STRING_LITERAL_QUOTE
: '"' (~ [\u0027\u005C\u000A\u000D] | ECHAR | UCHAR | '"')* '"'
: '"' (~["\\\r\n] | ECHAR | UCHAR)* '"'
;

STRING_LITERAL_SINGLE_QUOTE
: '\'' (~ [\u0027\u005C\u000A\u000D] | ECHAR | UCHAR | '\'')* '\''
: '\'' (~['\\\r\n] | ECHAR | UCHAR)* '\''
;

// Hexadecimal unicode character
Expand Down Expand Up @@ -257,7 +242,7 @@ PN_CHARS_BASE
| '\u3001' .. '\uD7FF'
| '\uF900' .. '\uFDCF'
| '\uFDF0' .. '\uFFFD'
// | '\u10000' .. '\uEFFFF'
| '\u{10000}'..'\u{EFFFF}'
;

PN_CHARS_U
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import fr.inria.corese.core.next.api.IRI;
import fr.inria.corese.core.next.api.base.io.AbstractIOOptions;
import fr.inria.corese.core.next.api.io.parser.RDFParserBaseIRIOptions;
import fr.inria.corese.core.next.api.io.serialization.SerializationOption;

/**
* Wrapper around the JsonLdOptions class for the Titanium JSONLD parser and
Expand All @@ -17,7 +18,8 @@
* @see <a href=
* "https://javadoc.io/doc/com.apicatalog/titanium-json-ld/latest/com/apicatalog/jsonld/JsonLdOptions.html">JsonLdOptions</a>
*/
public class TitaniumJSONLDProcessorOption extends AbstractIOOptions implements RDFParserBaseIRIOptions {
public class TitaniumJSONLDProcessorOption extends AbstractIOOptions
implements RDFParserBaseIRIOptions, SerializationOption {

private final Builder builder;

Expand Down Expand Up @@ -138,7 +140,8 @@ public String getBase() {
/**
* Builder for creating instances of TitaniumJSONLDProcessorOption.
* This nested static class provides a fluent API for configuring the
* various options before building the final {@code TitaniumJSONLDProcessorOption} object.
* various options before building the final
* {@code TitaniumJSONLDProcessorOption} object.
*/
public static class Builder extends AbstractIOOptions.Builder<TitaniumJSONLDProcessorOption> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import fr.inria.corese.core.next.impl.io.parser.ntriples.ANTLRNTriplesParser;
import fr.inria.corese.core.next.impl.io.parser.rdfxml.RDFXMLParser;
import fr.inria.corese.core.next.impl.io.parser.turtle.ANTLRTurtleParser;
import fr.inria.corese.core.next.impl.io.parser.trig.ANTLRTrigParser;

/**
* Factory class for creating RDF parsers. Generates according to the RDFFormat provided.
Expand Down Expand Up @@ -47,6 +48,8 @@ public RDFParser createRDFParser(RDFFormat format, Model model, ValueFactory fac
return new ANTLRNQuadsParser(model, factory, config);
} else if (format == RDFFormat.RDFXML) {
return new RDFXMLParser(model, factory, config);
} else if (format == RDFFormat.TRIG) {
return new ANTLRTrigParser(model, factory, config);
}
throw new IllegalArgumentException("Unsupported format: " + format);
}
Expand All @@ -70,8 +73,10 @@ public RDFParser createRDFParser(RDFFormat format, Model model, ValueFactory fac
return new ANTLRNQuadsParser(model, factory);
} else if (format == RDFFormat.RDFXML) {
return new RDFXMLParser(model, factory);
} else if (format == RDFFormat.TRIG) {
return new ANTLRTrigParser(model, factory);
}
throw new IllegalArgumentException("Unsupported format: " + format);
}

}
}
Loading