This commit is contained in:
tuvu
2025-02-11 13:25:08 +01:00
parent b087f2ddbe
commit b2fe10ea8b
4 changed files with 15 additions and 11 deletions

View File

@@ -1,10 +1,16 @@
# TP1 PDS - Traducteur RDF/Turtle vers RDF/Ntriples # TP1 PDS - Traducteur RDF/Turtle vers RDF/Ntriples
Ce projet VSCode contient tout le nécessaire pour commencer à programmer le traducteur. Réalisé par Thibaut ROCHAS et Tuan Minh VU
Vous pouvez forker ce dépôt, mais devez impérativement garder votre dépôt privé. ## Implémentation du ASD
```
Ce fichier `README.md` doit être complété au fur et à mesure de votre avancement. turtle ::= Turtle(phrase*)
phrase ::= Phrase(entity, aff*)
aff ::= Aff(entity, complement*)
complement ::= Complement(Entity)
| Complement_Text(String)
entity ::= Entity(String)
```
## Compatibilité ## Compatibilité

View File

@@ -13,7 +13,6 @@ options {
} }
// Whitespaces are ignored. // Whitespaces are ignored.
fragment WS: (' ' | '\n' | '\t' | '\r' | '\u000C'); fragment WS: (' ' | '\n' | '\t' | '\r' | '\u000C');
WSS: WS+ { skip(); }; WSS: WS+ { skip(); };

View File

@@ -13,7 +13,7 @@ public class ASD_Turtle implements TurtleASD {
public String toString(){ public String toString(){
String str = ""; String str = "";
for (PhraseImp phrase : this.phrases) { for (PhraseImp phrase : this.phrases) {
str+= phrase.toString(); str = str.concat(phrase.toString());
} }
return str; return str;
} }
@@ -22,7 +22,7 @@ public class ASD_Turtle implements TurtleASD {
public String toString(){ public String toString(){
String str = "<" + this.entity.toString() + ">\n"; String str = "<" + this.entity.toString() + ">\n";
for (int i =0; i < this.affs.size(); i++ ){ for (int i =0; i < this.affs.size(); i++ ){
str += affs.get(i).toString(); str =str.concat(affs.get(i).toString()) ;
if (i < this.affs.size() - 1) { if (i < this.affs.size() - 1) {
str += ";\n"; str += ";\n";
} }
@@ -33,9 +33,9 @@ public class ASD_Turtle implements TurtleASD {
} }
record AffectationImp(EntityImp entity, List<Complement> complements) implements Affectation{ record AffectationImp(EntityImp entity, List<Complement> complements) implements Affectation{
public String toString(){ public String toString(){
String str= "<" + this.entity.toString() + ">"; String str= "\t<" + this.entity.toString() + ">";
for (int i =0; i < this.complements.size(); i++) { for (int i =0; i < this.complements.size(); i++) {
str += (this.complements.get(i)); str = str.concat(this.complements.get(i).toString());
if (i < this.complements.size() - 1) { if (i < this.complements.size() - 1) {
str += ","; str += ",";
} }

View File

@@ -16,6 +16,7 @@ public class Main {
/** /**
* Buils example AST and illustrates the translator. * Buils example AST and illustrates the translator.
* *
LC : '<' LC : '<'
; ;
RC : '>' RC : '>'
@@ -46,11 +47,9 @@ public class Main {
morec : V comp morec : V comp
| |
; ;
*/ */
public static void manualAST() { public static void manualAST() {
//Ridoux <type> <personne>, <professeur>; //Ridoux <type> <personne>, <professeur>;
//System.out.println("Ridoux <type> <personne>, <professeur>;");
EntityImp Ridoux = new EntityImp("Ridoux"); EntityImp Ridoux = new EntityImp("Ridoux");
EntityImp type = new EntityImp("type"); EntityImp type = new EntityImp("type");
EntityImp personne = new EntityImp("personne"); EntityImp personne = new EntityImp("personne");