Browse Source

Working on model.

loconox 8 years ago
parent
commit
68f0a3ade3

+ 5 - 0
README.md

@@ -2,3 +2,8 @@ exegetes-doc-web
 ================
 
 A Symfony project created on March 28, 2017, 3:50 pm.
+
+REQUIREMENTS
+============
+* php70
+* php70-yaml

+ 17 - 0
app/Resources/schema/csl/.hgtags

@@ -0,0 +1,17 @@
+544b55341c0457a0824ae5426d9b1d47f0feac94 v0.8
+c0a2a975f78108cf6308a1b296e6b8901db955eb v1.0RC1
+c0a2a975f78108cf6308a1b296e6b8901db955eb v1.0RC1
+0000000000000000000000000000000000000000 v1.0RC1
+0000000000000000000000000000000000000000 v1.0RC1
+39b4473197929a62eb1f69a430595a41b443f77a v1.0RC1
+2f41485c1210c04e58b7a7b4f595929707d4118e v1.0RC2
+83f9cf9b53bd77dd4f75b3ad23a792ea2257ffd3 v0.8.1
+544b55341c0457a0824ae5426d9b1d47f0feac94 v0.8
+0000000000000000000000000000000000000000 v0.8
+0000000000000000000000000000000000000000 v0.8
+b1f8e3e1b41baebb3c3de2b547fea670afb191a8 v0.8
+855dcc00cba797a53092cb1df400cc113a1d7760 v1.0
+39b4473197929a62eb1f69a430595a41b443f77a v1.0RC1
+0000000000000000000000000000000000000000 v1.0RC1
+2f41485c1210c04e58b7a7b4f595929707d4118e v1.0RC2
+0000000000000000000000000000000000000000 v1.0RC2

+ 147 - 0
app/Resources/schema/csl/README.md

@@ -0,0 +1,147 @@
+This is the official repository for schemas describing the Citation Style
+Language (CSL). Current schemas include:
+
+* CSL schema - describes CSL style and locale XML files
+* CSL-JSON schema - describes a commonly used JSON data model for storing
+CSL processor input (such as bibliographic metadata)  
+
+For more information about CSL, visit
+[CitationStyles.org](http://citationstyles.org/).
+
+# CSL Schema
+
+The CSL schema is written in the compact syntax of [RELAX
+NG](http://relaxng.org/), and currently consists of the following files:
+
+* csl.rnc
+* csl-categories.rnc
+* csl-terms.rnc
+* csl-types.rnc
+* csl-variables.rnc
+
+CSL style and locale files should be validated against "csl.rnc", which
+incorporates the content of the other files.
+
+The CSL schema contains several [Schematron](http://www.schematron.com/)
+rules to make sure all macros called in a CSL style are actually defined.
+Since the popular [Jing](https://code.google.com/p/jing-trang/) XML
+validator currently ignores embedded Schematron rules, we also provide the
+"csl.sch" Schematron schema, which contains the Schematron rules extracted
+from the CSL schema. Jing users can use "csl.sch" to perform a secondary
+validation of CSL styles.
+
+# CSL-JSON Schema
+
+The CSL-JSON schema is written in [JSON Schema](http://json-schema.org/),
+and currently consists of the following files:
+
+* csl-data.json
+* csl-citation.json
+
+To render citations and bibliographies, CSL processors not only require CSL
+style and locale files, but also bibliographic metadata. The citeproc-js CSL
+processor
+[introduced](http://gsl-nagoya-u.net/http/pub/citeproc-doc.html#data-input)
+a JSON format to store such metadata, and this format has since been adopted
+by various other software products. The format, also known as
+"citeproc-JSON", has been codified in the CSL-JSON Schema.
+
+***At this point the CSL-JSON schema is not yet fully normative, and care
+must be taken to ensure compatibility with other tools built around
+CSL-JSON.***
+
+Whereas "csl-data.json" describes how the metadata of bibliographic items
+can be stored, "csl-citation.json" incorporates "csl-data.json" and adds an
+additional layer of information to also describe the context in which
+bibliographic items are cited. This includes information such as the order
+in which items are cited, which items are cited together in a single
+citation, etc.
+
+## Mendeley CSL-JSON
+
+Mendeley provided the following documentation on their use of CSL-JSON:
+
+Support for the CSL Embedded Citation Object format is available in
+Mendeley Desktop 1.0 and later.
+
+The CSL citation data object consists of:
+
+* a required "schema" element of type "string", set to the URI of the schema
+* a required "citationID" element of type "string" or "number", set to ???
+* a "citationItems" element of type "array", containing "objects" with the data
+  of the individual cites. The individual cite object are structured as:
+
+  * a required "id" element of type "string" or "number", set to an unique cite
+    ID
+  * a "itemData" element of type "object", described in "csl-data.json/#/items",
+    containing the metadata of a single bibliographic item (this object is
+    returned in citeproc-js by "sys.retrieveItem()")
+  * an "uris" element of type "array", which can contain any number of URIs (of
+    type "string") to the bibliographic item
+  * a "prefix" element of type "string"
+  * a "suffix" element of type "string"
+  * a "locator" element of type "string"
+  * a "label" element of type "string", set to one of the CSL locator types (see
+    http://citationstyles.org/downloads/specification.html#locators)
+  * a "suppress-author" element of type "string", "boolean" or "number"
+  * a "author-only" element of type "string", "boolean" or "number"
+* a "properties" element of type "object" containing:
+  * a "noteIndex" element of type "number", set to the index of the footnote or
+    endnote
+* (Mendeley-specific) a "mendeley" element of type "object" containing:
+  * a "previouslyFormattedCitation" element of type "string", set to the
+    rendered output of the cite of the previous rendering round (this can be
+    used to determine if the user manually altered the output)
+  * a "manualFormatting" element of type "string", set to the user-customized
+    output of the cite (this output will be used in favor of the generated
+    output)
+
+The method to embed metadata for citations and bibliographies typically varies
+between word processors. Currently Mendeley uses:
+
+* For Word for Windows: in-text citations and bibliographies are represented by
+  a field code of type "wdFieldAddin" or temporarily represented as a bookmark
+  if exporting to OpenOffice
+* For OpenOffice: in-text citations are of type
+  "com.sun.star.text.ReferenceMark", bibliographies are of type
+  "com.sun.star.text.TextSection" or temporarily represented as a bookmark if
+  exporting to Word
+
+An example of an embedded citation object from Mendeley:
+
+```
+{
+    "schema": "https://github.com/citation-style-language/schema/raw/master/csl-citation.json",
+    "citationID": "12rsus7rlj",
+    "citationItems": [
+        {
+            "id": "ITEM-1",
+            "itemData": {
+                "id": "ITEM-1",
+                "issued": {
+                    "date-parts": [
+                        [
+                            "2007"
+                        ]
+                    ]
+                },
+                "title": "My paper",
+                "type": "journal-article"
+            },
+            "locator": "21",
+            "label": "page",
+            "uris": [
+                "http://www.mendeley.com/documents/?uuid=970e7ce0-8a21-482e-b7d6-e77794a2d37d",
+                "http://www.zotero.org/uniqueDocumentId"
+            ]
+        }
+    ],
+    "mendeley": {
+        "previouslyFormattedCitation": "(2007)",
+        "manualFormatting": "2007b"
+    },
+    "properties": {
+        "noteIndex": 1
+    }
+}
+```

+ 36 - 0
app/Resources/schema/csl/csl-categories.rnc

@@ -0,0 +1,36 @@
+
+## Categories for style metadata
+div {
+  category.citation-format =
+    "author" | "author-date" | "label" | "note" | "numeric"
+  
+  ## Use "generic-base" for styles that are non-discipline specific, such as
+  ## APA, Harvard, etc.
+  category.field =
+    "anthropology"
+    | "astronomy"
+    | "biology"
+    | "botany"
+    | "chemistry"
+    | "communications"
+    | "engineering"
+    | "generic-base"
+    | "geography"
+    | "geology"
+    | "history"
+    | "humanities"
+    | "law"
+    | "linguistics"
+    | "literature"
+    | "math"
+    | "medicine"
+    | "philosophy"
+    | "physics"
+    | "political_science"
+    | "psychology"
+    | "science"
+    | "social_science"
+    | "sociology"
+    | "theology"
+    | "zoology"
+}

+ 100 - 0
app/Resources/schema/csl/csl-citation.json

@@ -0,0 +1,100 @@
+{
+    "description": "JSON schema (draft 3) for CSL citation objects",
+    "id": "https://github.com/citation-style-language/schema/raw/master/csl-citation.json",
+    "type": "object",
+    "properties": {
+        "schema": {
+            "type": "string",
+            "required": true,
+            "enum" : [
+                "https://github.com/citation-style-language/schema/raw/master/csl-citation.json" 
+            ] 
+        },
+        "citationID": {
+            "type": [
+                "string",
+                "number" 
+            ],
+            "required": true 
+        },
+        "citationItems": {
+            "type": "array",
+            "items": {
+                "type": "object",
+                "properties": {
+                    "id": {
+                        "type": [
+                            "string",
+                            "number" 
+                        ],
+                        "required": true 
+                    },
+                    "itemData": {
+                        "$ref": "csl-data.json/#/items" 
+                    },
+                    "prefix": {
+                        "type": "string" 
+                    },
+                    "suffix": {
+                        "type": "string" 
+                    },
+                    "locator": {
+                        "type": "string" 
+                    },
+                    "label": {
+                        "type": "string",
+                        "enum": [
+                            "book",
+                            "chapter",
+                            "column",
+                            "figure",
+                            "folio",
+                            "issue",
+                            "line",
+                            "note",
+                            "opus",
+                            "page",
+                            "paragraph",
+                            "part",
+                            "section",
+                            "sub verbo",
+                            "verse",
+                            "volume" 
+                        ] 
+                    },
+                    "suppress-author": {
+                        "type": [
+                            "string",
+                            "number",
+                            "boolean" 
+                        ] 
+                    },
+                    "author-only": {
+                        "type": [
+                            "string",
+                            "number",
+                            "boolean" 
+                        ] 
+                    },
+                    "uris": {
+                        "type": "array",
+                        "items": {
+                            "type": "string" 
+                        } 
+                    } 
+                },
+                "additionalProperties" : false 
+            } 
+        },
+        "properties": {
+            "type": "object",
+            "properties": {
+                "noteIndex": {
+                    "type": "number" 
+                } 
+            },
+            "additionalProperties" : false 
+        } 
+    },
+    "additionalProperties" : false 
+}

+ 452 - 0
app/Resources/schema/csl/csl-data-custom.json

@@ -0,0 +1,452 @@
+{
+    "description": "JSON schema (draft 3) for CSL input data",
+    "id": "https://github.com/citation-style-language/schema/raw/master/csl-data.json",
+    "type": "array",
+    "items": {
+        "type": "object",
+        "properties": {
+            "type": {
+                "type": "string",
+                "required": true,
+                "enum": [
+                    "article",
+                    "article-journal",
+                    "article-magazine",
+                    "article-newspaper",
+                    "bill",
+                    "book",
+                    "broadcast",
+                    "chapter",
+                    "dataset",
+                    "entry",
+                    "entry-dictionary",
+                    "entry-encyclopedia",
+                    "figure",
+                    "graphic",
+                    "interview",
+                    "legal_case",
+                    "legislation",
+                    "manuscript",
+                    "map",
+                    "motion_picture",
+                    "musical_score",
+                    "pamphlet",
+                    "paper-conference",
+                    "patent",
+                    "personal_communication",
+                    "post",
+                    "post-weblog",
+                    "report",
+                    "review",
+                    "review-book",
+                    "song",
+                    "speech",
+                    "thesis",
+                    "treaty",
+                    "webpage"
+                ]
+            },
+            "id": {
+                "type": [
+                    "string",
+                    "number"
+                ],
+                "required": true
+            },
+            "categories": {
+                "type": "array",
+                "items": {
+                    "type": "string"
+                }
+            },
+            "language": {
+                "type": "string"
+            },
+            "journalAbbreviation": {
+                "type": "string"
+            },
+            "shortTitle": {
+                "type": "string"
+            },
+            "author": {
+                "type": "array",
+                "items": {
+                    "id": "name-variable",
+                    "type": [
+                        {
+                            "properties": {
+                                "family": {
+                                    "type": "string"
+                                },
+                                "given": {
+                                    "type": "string"
+                                },
+                                "dropping-particle": {
+                                    "type": "string"
+                                },
+                                "non-dropping-particle": {
+                                    "type": "string"
+                                },
+                                "suffix": {
+                                    "type": "string"
+                                },
+                                "comma-suffix": {
+                                    "type": [
+                                        "string",
+                                        "number",
+                                        "boolean"
+                                    ]
+                                },
+                                "static-ordering": {
+                                    "type": [
+                                        "string",
+                                        "number",
+                                        "boolean"
+                                    ]
+                                },
+                                "literal": {
+                                    "type": "string"
+                                },
+                                "parse-names": {
+                                    "type": [
+                                        "string",
+                                        "number",
+                                        "boolean"
+                                    ]
+                                }
+                            },
+                            "additionalProperties": false
+                        },
+                        {
+                            "properties": {
+                                "literal": {
+                                    "type": "string"
+                                }
+                            },
+                            "additionalProperties": false
+                        }
+                    ]
+                }
+            },
+            "collection-editor": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "composer": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "container-author": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "director": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "editor": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "editorial-director": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "interviewer": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "illustrator": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "original-author": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "recipient": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "reviewed-author": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "translator": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable"
+                }
+            },
+            "accessed": {
+                "id": "date-variable",
+                "type": [
+                    {
+                        "properties": {
+                            "date-parts": {
+                                "type": "array",
+                                "items": {
+                                    "type": "array",
+                                    "items": {
+                                        "type": [
+                                            "string",
+                                            "number"
+                                        ]
+                                    },
+                                    "maxItems": 3
+                                },
+                                "maxItems": 2
+                            },
+                            "season": {
+                                "type": [
+                                    "string",
+                                    "number"
+                                ]
+                            },
+                            "circa": {
+                                "type": [
+                                    "string",
+                                    "number",
+                                    "boolean"
+                                ]
+                            },
+                            "literal": {
+                                "type": "string"
+                            },
+                            "raw": {
+                                "type": "string"
+                            }
+                        },
+                        "additionalProperties": false
+                    },
+                    {
+                        "properties": {
+                            "literal": {
+                                "type": "string"
+                            }
+                        },
+                        "additionalProperties": false
+                    }
+                ]
+            },
+            "container": {
+                "$ref": "date-variable"
+            },
+            "event-date": {
+                "$ref": "date-variable"
+            },
+            "issued": {
+                "$ref": "date-variable"
+            },
+            "original-date": {
+                "$ref": "date-variable"
+            },
+            "submitted": {
+                "$ref": "date-variable"
+            },
+            "abstract": {
+                "type": "string"
+            },
+            "annote": {
+                "type": "string"
+            },
+            "archive": {
+                "type": "string"
+            },
+            "archive_location": {
+                "type": "string"
+            },
+            "archive-place": {
+                "type": "string"
+            },
+            "authority": {
+                "type": "string"
+            },
+            "call-number": {
+                "type": "string"
+            },
+            "chapter-number": {
+                "type": "string"
+            },
+            "citation-number": {
+                "type": "string"
+            },
+            "citation-label": {
+                "type": "string"
+            },
+            "collection-number": {
+                "type": "string"
+            },
+            "collection-title": {
+                "type": "string"
+            },
+            "container-title": {
+                "type": "string"
+            },
+            "container-title-short": {
+                "type": "string"
+            },
+            "dimensions": {
+                "type": "string"
+            },
+            "DOI": {
+                "type": "string"
+            },
+            "edition": {
+                "type": [
+                    "string",
+                    "number"
+                ]
+            },
+            "event": {
+                "type": "string"
+            },
+            "event-place": {
+                "type": "string"
+            },
+            "first-reference-note-number": {
+                "type": "string"
+            },
+            "genre": {
+                "type": "string"
+            },
+            "ISBN": {
+                "type": "string"
+            },
+            "ISSN": {
+                "type": "string"
+            },
+            "issue": {
+                "type": [
+                    "string",
+                    "number"
+                ]
+            },
+            "jurisdiction": {
+                "type": "string"
+            },
+            "keyword": {
+                "type": "string"
+            },
+            "locator": {
+                "type": "string"
+            },
+            "medium": {
+                "type": "string"
+            },
+            "note": {
+                "type": "string"
+            },
+            "number": {
+                "type": [
+                    "string",
+                    "number"
+                ]
+            },
+            "number-of-pages": {
+                "type": "string"
+            },
+            "number-of-volumes": {
+                "type": [
+                    "string",
+                    "number"
+                ]
+            },
+            "original-publisher": {
+                "type": "string"
+            },
+            "original-publisher-place": {
+                "type": "string"
+            },
+            "original-title": {
+                "type": "string"
+            },
+            "page": {
+                "type": "string"
+            },
+            "page-first": {
+                "type": "string"
+            },
+            "PMCID": {
+                "type": "string"
+            },
+            "PMID": {
+                "type": "string"
+            },
+            "publisher": {
+                "type": "string"
+            },
+            "publisher-place": {
+                "type": "string"
+            },
+            "references": {
+                "type": "string"
+            },
+            "reviewed-title": {
+                "type": "string"
+            },
+            "scale": {
+                "type": "string"
+            },
+            "section": {
+                "type": "string"
+            },
+            "source": {
+                "type": "string"
+            },
+            "status": {
+                "type": "string"
+            },
+            "title": {
+                "type": "string"
+            },
+            "title-short": {
+                "type": "string"
+            },
+            "URL": {
+                "type": "string"
+            },
+            "version": {
+                "type": "string"
+            },
+            "volume": {
+                "type": [
+                    "string",
+                    "number"
+                ]
+            },
+            "year-suffix": {
+                "type": "string"
+            },
+            "ECLI": {
+                "type": "string"
+            },
+            "comments": {
+                "type": "string"
+            }
+        },
+        "additionalProperties": false
+    }
+}

+ 446 - 0
app/Resources/schema/csl/csl-data.json

@@ -0,0 +1,446 @@
+{
+    "description": "JSON schema (draft 3) for CSL input data",
+    "id": "https://github.com/citation-style-language/schema/raw/master/csl-data.json",
+    "type": "array",
+    "items": {
+        "type": "object",
+        "properties": {
+            "type": {
+                "type": "string",
+                "required": true,
+                "enum" : [
+                    "article",
+                    "article-journal",
+                    "article-magazine",
+                    "article-newspaper",
+                    "bill",
+                    "book",
+                    "broadcast",
+                    "chapter",
+                    "dataset",
+                    "entry",
+                    "entry-dictionary",
+                    "entry-encyclopedia",
+                    "figure",
+                    "graphic",
+                    "interview",
+                    "legal_case",
+                    "legislation",
+                    "manuscript",
+                    "map",
+                    "motion_picture",
+                    "musical_score",
+                    "pamphlet",
+                    "paper-conference",
+                    "patent",
+                    "personal_communication",
+                    "post",
+                    "post-weblog",
+                    "report",
+                    "review",
+                    "review-book",
+                    "song",
+                    "speech",
+                    "thesis",
+                    "treaty",
+                    "webpage" 
+                ] 
+            },
+            "id": {
+                "type": [
+                    "string",
+                    "number" 
+                ],
+                "required": true 
+            },
+            "categories": {
+                "type": "array",
+                "items": {
+                    "type": "string" 
+                } 
+            },
+            "language": {
+                "type": "string" 
+            },
+            "journalAbbreviation": {
+                "type": "string" 
+            },
+            "shortTitle": {
+                "type": "string" 
+            },
+            "author": {
+                "type": "array",
+                "items": {
+                    "id": "name-variable",
+                    "type": [
+                        {
+                            "properties": {
+                                "family" : {
+                                    "type": "string" 
+                                },
+                                "given" : {
+                                    "type": "string" 
+                                },
+                                "dropping-particle" : {
+                                    "type": "string" 
+                                },
+                                "non-dropping-particle" : {
+                                    "type": "string" 
+                                },
+                                "suffix" : {
+                                    "type": "string" 
+                                },
+                                "comma-suffix" : {
+                                    "type": [
+                                        "string",
+                                        "number",
+                                        "boolean" 
+                                    ] 
+                                },
+                                "static-ordering" : {
+                                    "type": [
+                                        "string",
+                                        "number",
+                                        "boolean" 
+                                    ] 
+                                },
+                                "literal" : {
+                                    "type": "string" 
+                                },
+                                "parse-names" : {
+                                    "type": [
+                                        "string",
+                                        "number",
+                                        "boolean" 
+                                    ] 
+                                } 
+                            },
+                            "additionalProperties" : false 
+                        },
+                        {
+                            "properties": {
+                                "literal" : {
+                                    "type": "string" 
+                                } 
+                            },
+                            "additionalProperties" : false 
+                        } 
+                    ] 
+                } 
+            },
+            "collection-editor": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "composer": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "container-author": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "director": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "editor": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "editorial-director": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "interviewer": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "illustrator": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "original-author": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "recipient": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "reviewed-author": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "translator": {
+                "type": "array",
+                "items": {
+                    "$ref": "name-variable" 
+                } 
+            },
+            "accessed": {
+                "id": "date-variable",
+                "type": [
+                    {
+                        "properties": {
+                            "date-parts": {
+                                "type": "array",
+                                "items": {
+                                    "type": "array",
+                                    "items": {
+                                        "type": [
+                                            "string",
+                                            "number" 
+                                        ] 
+                                    },
+                                    "maxItems": 3 
+                                },
+                                "maxItems": 2 
+                            },
+                            "season": {
+                                "type": [
+                                    "string",
+                                    "number" 
+                                ] 
+                            },
+                            "circa": {
+                                "type": [
+                                    "string",
+                                    "number",
+                                    "boolean" 
+                                ] 
+                            },
+                            "literal": {
+                                "type": "string" 
+                            },
+                            "raw": {
+                                "type": "string" 
+                            }
+                        },
+                        "additionalProperties" : false 
+                    },
+                    {
+                        "properties": {
+                            "literal": {
+                                "type": "string" 
+                            } 
+                        },
+                        "additionalProperties" : false 
+                    } 
+                ] 
+            },
+            "container": {
+                "$ref": "date-variable" 
+            },
+            "event-date": {
+                "$ref": "date-variable" 
+            },
+            "issued": {
+                "$ref": "date-variable" 
+            },
+            "original-date": {
+                "$ref": "date-variable" 
+            },
+            "submitted": {
+                "$ref": "date-variable" 
+            },
+            "abstract": {
+                "type": "string" 
+            },
+            "annote": {
+                "type": "string" 
+            },
+            "archive": {
+                "type": "string" 
+            },
+            "archive_location": {
+                "type": "string" 
+            },
+            "archive-place": {
+                "type": "string" 
+            },
+            "authority": {
+                "type": "string" 
+            },
+            "call-number": {
+                "type": "string" 
+            },
+            "chapter-number": {
+                "type": "string" 
+            },
+            "citation-number": {
+                "type": "string" 
+            },
+            "citation-label": {
+                "type": "string" 
+            },
+            "collection-number": {
+                "type": "string" 
+            },
+            "collection-title": {
+                "type": "string" 
+            },
+            "container-title": {
+                "type": "string" 
+            },
+            "container-title-short": {
+                "type": "string" 
+            },
+            "dimensions": {
+                "type": "string" 
+            },
+            "DOI": {
+                "type": "string" 
+            },
+            "edition": {
+                "type": [
+                    "string",
+                    "number" 
+                ] 
+            },
+            "event": {
+                "type": "string" 
+            },
+            "event-place": {
+                "type": "string" 
+            },
+            "first-reference-note-number": {
+                "type": "string" 
+            },
+            "genre": {
+                "type": "string" 
+            },
+            "ISBN": {
+                "type": "string" 
+            },
+            "ISSN": {
+                "type": "string" 
+            },
+            "issue": {
+                "type": [
+                    "string",
+                    "number" 
+                ] 
+            },
+            "jurisdiction": {
+                "type": "string" 
+            },
+            "keyword": {
+                "type": "string" 
+            },
+            "locator": {
+                "type": "string" 
+            },
+            "medium": {
+                "type": "string" 
+            },
+            "note": {
+                "type": "string" 
+            },
+            "number": {
+                "type": [
+                    "string",
+                    "number" 
+                ] 
+            },
+            "number-of-pages": {
+                "type": "string" 
+            },
+            "number-of-volumes": {
+                "type": [
+                    "string",
+                    "number" 
+                ] 
+            },
+            "original-publisher": {
+                "type": "string" 
+            },
+            "original-publisher-place": {
+                "type": "string" 
+            },
+            "original-title": {
+                "type": "string" 
+            },
+            "page": {
+                "type": "string" 
+            },
+            "page-first": {
+                "type": "string" 
+            },
+            "PMCID": {
+                "type": "string" 
+            },
+            "PMID": {
+                "type": "string" 
+            },
+            "publisher": {
+                "type": "string" 
+            },
+            "publisher-place": {
+                "type": "string" 
+            },
+            "references": {
+                "type": "string" 
+            },
+            "reviewed-title": {
+                "type": "string" 
+            },
+            "scale": {
+                "type": "string" 
+            },
+            "section": {
+                "type": "string" 
+            },
+            "source": {
+                "type": "string" 
+            },
+            "status": {
+                "type": "string" 
+            },
+            "title": {
+                "type": "string" 
+            },
+            "title-short": {
+                "type": "string" 
+            },
+            "URL": {
+                "type": "string" 
+            },
+            "version": {
+                "type": "string" 
+            },
+            "volume": {
+                "type": [
+                    "string",
+                    "number" 
+                ] 
+            },
+            "year-suffix": {
+                "type": "string" 
+            } 
+        },
+        "additionalProperties" : false 
+    } 
+}

+ 103 - 0
app/Resources/schema/csl/csl-data.rnc

@@ -0,0 +1,103 @@
+namespace dc = "http://purl.org/dc/elements/1.1/"
+
+dc:title [ "Citation Style Language Data" ]
+dc:creator [ "Bruce D'Arcus" ]
+dc:copyright [ "Bruce D'Arcus, 2009" ]
+dc:description [ "A schema for the CSL data model." ]
+include "csl-types.rnc"
+include "csl-variables.rnc"
+start = element references { reference+ }
+reference = element reference { type, id, uri?, container-uri?, (contributor* & date* & variable+) }
+
+## Types 
+div {
+  type = attribute type { cs-types }
+}
+
+## Identifiers
+div {
+
+   ## The id is an identifier unique to the scope of the file
+   id = attribute id { token }
+   
+   ## The URI is the global identity for the refererence; used to associate a citation reference to its data
+   uri = attribute uri { xsd:anyURI }
+  
+   ## the URI for containing items (such as edited books or journals)
+   container-uri = attribute container-uri { xsd:anyURI }
+}
+
+## Contributors
+div {
+   contributor =
+      element contributor {
+         attribute type { cs-names },
+         name-elements
+      }
+   name-elements =
+      element name { text }
+    | ((element given { text }? &
+       element family { text }?) &
+       element dropping-particle { text }? &
+       element non-dropping-particle { text }? &
+       element suffix { text }?)
+}
+
+## Dates
+div {
+   date =
+      element date { 
+         attribute type { cs-dates }, 
+         attribute circa { xsd:boolean }?,
+         (date-pattern | date-range)
+      }
+   date-pattern =
+      year-pattern,
+      ( ( month-pattern, day-pattern? ) | season-pattern )?
+   date-range =
+      element begin-date { date-pattern },
+      element end-date { date-pattern }?
+   year-pattern =
+      attribute year {
+         xsd:integer { maxInclusive="-1" }
+       | xsd:integer { minInclusive="1" }
+      }
+   month-pattern =
+      attribute month { xsd:integer { minInclusive="1" maxInclusive="12" } }
+   day-pattern =
+      attribute day { xsd:integer { minInclusive="1" maxInclusive="31" } }
+
+   # 1 = Spring, 2 = Summer, 3 = Fall, 4 = Winter
+   season-pattern =
+      attribute season { xsd:integer { minInclusive="1" maxInclusive="4" } }
+}
+
+## Simple Variables
+div {
+   variable =
+      element variable {
+         attribute type { cs-variables },
+         (simple-variable-pattern | rich-variable-pattern)
+      }
+   simple-variable-pattern = text
+   rich-variable-pattern =
+      (text
+       | element abbr { text }
+       | element b { text }
+       | element cite {
+          
+          ## cited title which is a part (like an article), and so typically rendered in quotes, rather than italicized
+          attribute class { "part" }?,
+          text
+       }
+       | element i { text }
+       | element sc { text }
+       | element span {
+          
+          ## text whose case should not be transformed (as with proper nouns)
+          attribute class { "protect" }?,
+          text
+       }
+       | element sup { text }
+       | element sub { text })+
+}

+ 13 - 0
app/Resources/schema/csl/csl-relaxed.rnc

@@ -0,0 +1,13 @@
+namespace cs = "http://purl.org/net/xbiblio/csl"
+namespace dc = "http://purl.org/dc/elements/1.1/"
+
+dc:title [ "Citation Style Language Schema - Relaxed" ]
+dc:creator [ "Bruce D'Arcus" ]
+dc:rights [ "Permission to freely use, copy and distribute." ]
+dc:description [
+    "Relaxes the need for a cs:updated value in the official CSL schema."
+]
+
+include "csl.rnc"{
+   info-updated = element cs:updated { xsd:dateTime? }
+}

+ 144 - 0
app/Resources/schema/csl/csl-repository.rnc

@@ -0,0 +1,144 @@
+namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
+namespace cs = "http://purl.org/net/xbiblio/csl"
+namespace dc = "http://purl.org/dc/elements/1.1/"
+
+dc:title [ "Extension schema for the Citation Style Language styles repository" ]
+dc:creator [ "Rintze M. Zelle" ]
+dc:rights [
+  "Copyright 2013 Rintze M. Zelle. Permission to freely use, copy and distribute."
+]
+dc:description [
+  "Enforces stricter requirements for the styles in the official CSL styles repository."
+]
+
+include "csl.rnc" {
+
+  ## Remove legacy attributes from cs:style of dependents
+  dependent-style.style =
+    element cs:style {
+      style.default-locale,
+      version,
+      dependent-style.style.info
+    }
+
+  ## - Only allow cs:issn once
+  ## - Require a cs:rights element
+  ## - Forgo "interleave" (so the elements need to be in the order specified),
+  ##   so that we can require
+  ##   * one cs:link with "self"
+  ##   * any number of cs:link with "template"
+  ##   * at least one cs:link with "documentation"
+  ##   * one cs:category with "citation-format"
+  ##   * any number of cs:category with "field".
+  ## Metadata for independent styles.
+  independent-style.style.info =
+    element cs:info {
+      info.title,
+      info.title-short?,
+      info.id,
+      independent-style.info.link.self,
+      independent-style.info.link.template*,
+      independent-style.info.link.documentation+,
+      info.author*,
+      info.contributor*,
+      info.category.citation-format,
+      info.category.field*,
+      info.issn?,
+      info.eissn?,
+      info.issnl?,
+      info.summary?,
+      info.published?,
+      info.updated,
+      info.rights
+    }
+    
+  ## - Only allow cs:issn once
+  ## - Require a cs:rights element
+  ## - Forgo "interleave" (so the elements need to be in the order specified),
+  ##   so that we can require
+  ##   * one cs:link with "self"
+  ##   * one cs:link with "independent-parent"
+  ##   * any number of cs:link with "documentation"
+  ##   * one cs:category with "citation-format"
+  ##   * any number of cs:category with "field".
+  ## Metadata for dependent styles.
+  dependent-style.style.info =
+    element cs:info {
+      info.title,
+      info.title-short?,
+      info.id,
+      independent-style.info.link.self,
+      independent-style.info.link.independent-parent,
+      independent-style.info.link.documentation*,
+      info.author*,
+      info.contributor*,
+      info.category.citation-format,
+      info.category.field*,
+      info.issn?,
+      info.eissn?,
+      info.issnl?,
+      info.summary?,
+      info.published?,
+      info.updated,
+      info.rights
+    }
+
+  ## Require "license" attribute; require specific value for "license" attribute and
+  ## text content for cs:rights
+  info.rights =
+    element cs:rights {
+      attribute license { "http://creativecommons.org/licenses/by-sa/3.0/" },
+      attribute xml:lang { xsd:language }?,
+      "This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License"
+    }
+
+  ## Remove legacy attributes from cs:et-al
+  names.et-al =
+    
+    ## Specify the term used for et-al abbreviation and its formatting. 
+    element cs:et-al {
+      
+      ## Select the term to use for et-al abbreviation.
+      [ a:defaultValue = "et-al" ]
+      attribute term { "et-al" | "and others" }?,
+      font-formatting
+    }
+}
+
+independent-style.info.link.self =
+element cs:link {
+  attribute href { xsd:anyURI },
+  attribute rel { "self" },
+  info-text
+}
+
+independent-style.info.link.template =
+element cs:link {
+  attribute href { xsd:anyURI },
+  attribute rel { "template" },
+  info-text
+}
+
+independent-style.info.link.independent-parent =
+element cs:link {
+  attribute href { xsd:anyURI },
+  attribute rel { "independent-parent" },
+  info-text
+}
+
+independent-style.info.link.documentation =
+element cs:link {
+  attribute href { xsd:anyURI },
+  attribute rel { "documentation" },
+  info-text
+}
+
+info.category.citation-format =
+element cs:category {
+  attribute citation-format { category.citation-format }
+}
+
+info.category.field =
+element cs:category {
+  attribute field { category.field }
+}

+ 138 - 0
app/Resources/schema/csl/csl-terms.rnc

@@ -0,0 +1,138 @@
+
+## Terms
+div {
+  terms =
+    terms.gender-assignable
+    | terms.gender-variants
+    | terms.locator
+    | 
+      ## Contributor roles
+      variables.names
+    | "editortranslator"
+    | 
+      ## Miscellaneous terms
+      "accessed"
+    | "ad"
+    | "and"
+    | "and others"
+    | "anonymous"
+    | "at"
+    | "available at"
+    | "bc"
+    | "by"
+    | "circa"
+    | "cited"
+    | "et-al"
+    | "forthcoming"
+    | "from"
+    | "ibid"
+    | "in"
+    | "in press"
+    | "internet"
+    | "interview"
+    | "letter"
+    | "no date"
+    | "online"
+    | "presented at"
+    | "reference"
+    | "retrieved"
+    | "scale"
+    | "version"
+    | 
+      ## Punctuation
+      "open-quote"
+    | "close-quote"
+    | "open-inner-quote"
+    | "close-inner-quote"
+    | "page-range-delimiter"
+    | 
+      ## Seasons
+      "season-01"
+    | "season-02"
+    | "season-03"
+    | "season-04"
+    |
+      ## (legacy; remove in CSL 1.1)
+      category.field
+  
+  ## Terms to which a gender may be assigned
+  terms.gender-assignable =
+    
+    ## Months
+    "month-01"
+    | "month-02"
+    | "month-03"
+    | "month-04"
+    | "month-05"
+    | "month-06"
+    | "month-07"
+    | "month-08"
+    | "month-09"
+    | "month-10"
+    | "month-11"
+    | "month-12"
+    | terms.non-locator-number-variables
+    | terms.locator-number-variables
+  
+  ## Terms for which gender variants may be specified
+  terms.gender-variants =
+    terms.ordinals
+    | terms.long-ordinals
+  
+  terms.ordinals =
+    
+    ## Ordinals
+    xsd:string { pattern = "ordinal(-\d{2})?" }
+  
+  terms.long-ordinals =
+    
+    ## Long ordinals
+    "long-ordinal-01"
+    | "long-ordinal-02"
+    | "long-ordinal-03"
+    | "long-ordinal-04"
+    | "long-ordinal-05"
+    | "long-ordinal-06"
+    | "long-ordinal-07"
+    | "long-ordinal-08"
+    | "long-ordinal-09"
+    | "long-ordinal-10"
+  
+  ## Locators
+  terms.locator =
+    terms.locator.testable
+    | 
+      ## "sub verbo" is recognized as "sub" & "verbo" in attribute lists; term
+      ## should be renamed to "sub-verbo"
+      "sub verbo"
+    
+  ## Locator terms that can be tested with the "locator" conditional
+  ## ("sub verbo" can be tested with "sub-verbo")
+  terms.locator.testable =
+    "book"
+    | "chapter"
+    | "column"
+    | "figure"
+    | "folio"
+    | "line"
+    | "note"
+    | "opus"
+    | "page"
+    | "paragraph"
+    | "part"
+    | "section"
+    | "verse"
+    | terms.locator-number-variables
+  
+  ## Locator terms with matching number variables
+  terms.locator-number-variables = "issue" | "volume"
+  
+  ## Non-locator terms accompanying number variables
+  terms.non-locator-number-variables =
+    "chapter-number"
+    | "collection-number"
+    | "edition"
+    | "number"
+    | "number-of-pages"
+    | "number-of-volumes"
+}

+ 40 - 0
app/Resources/schema/csl/csl-types.rnc

@@ -0,0 +1,40 @@
+
+## Item types
+div {
+  item-types =
+    "article"
+    | "article-journal"
+    | "article-magazine"
+    | "article-newspaper"
+    | "bill"
+    | "book"
+    | "broadcast"
+    | "chapter"
+    | "dataset"
+    | "entry"
+    | "entry-dictionary"
+    | "entry-encyclopedia"
+    | "figure"
+    | "graphic"
+    | "interview"
+    | "legal_case"
+    | "legislation"
+    | "manuscript"
+    | "map"
+    | "motion_picture"
+    | "musical_score"
+    | "pamphlet"
+    | "paper-conference"
+    | "patent"
+    | "personal_communication"
+    | "post"
+    | "post-weblog"
+    | "report"
+    | "review"
+    | "review-book"
+    | "song"
+    | "speech"
+    | "thesis"
+    | "treaty"
+    | "webpage"
+}

+ 98 - 0
app/Resources/schema/csl/csl-variables.rnc

@@ -0,0 +1,98 @@
+
+## Variables
+div {
+  
+  ## All variables
+  variables =
+    variables.dates
+    | variables.names
+    | variables.numbers
+    | variables.strings
+  
+  ## Standard variables
+  variables.standard = variables.numbers | variables.strings
+  
+  ## Date variables
+  variables.dates =
+    "accessed"
+    | "container"
+    | "event-date"
+    | "issued"
+    | "original-date"
+    | "submitted"
+  
+  ## Name variables
+  variables.names =
+    "author"
+    | "collection-editor"
+    | "composer"
+    | "container-author"
+    | "director"
+    | "editor"
+    | "editorial-director"
+    | "illustrator"
+    | "interviewer"
+    | "original-author"
+    | "recipient"
+    | "reviewed-author"
+    | "translator"
+  
+  ## Number variables
+  variables.numbers =
+    "chapter-number"
+    | "collection-number"
+    | "edition"
+    | "issue"
+    | "number"
+    | "number-of-pages"
+    | "number-of-volumes"
+    | "volume"
+  
+  ## String variables
+  variables.strings =
+    "abstract"
+    | "annote"
+    | "archive"
+    | "archive_location"
+    | "archive-place"
+    | "authority"
+    | "call-number"
+    | "citation-label"
+    | "citation-number"
+    | "collection-title"
+    | "container-title"
+    | "container-title-short"
+    | "dimensions"
+    | "DOI"
+    | "event"
+    | "event-place"
+    | "first-reference-note-number"
+    | "genre"
+    | "ISBN"
+    | "ISSN"
+    | "jurisdiction"
+    | "keyword"
+    | "locator"
+    | "medium"
+    | "note"
+    | "original-publisher"
+    | "original-publisher-place"
+    | "original-title"
+    | "page"
+    | "page-first"
+    | "PMID"
+    | "PMCID"
+    | "publisher"
+    | "publisher-place"
+    | "references"
+    | "reviewed-title"
+    | "scale"
+    | "section"
+    | "source"
+    | "status"
+    | "title"
+    | "title-short"
+    | "URL"
+    | "version"
+    | "year-suffix"
+}

File diff suppressed because it is too large
+ 1173 - 0
app/Resources/schema/csl/csl.rnc


+ 20 - 0
app/Resources/schema/csl/csl.sch

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<sch:schema xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0">
+   <sch:ns xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:bibo="http://purl.org/ontology/bibo/" xmlns:cs="http://purl.org/net/xbiblio/csl" xmlns="http://relaxng.org/ns/structure/1.0" uri="http://purl.org/net/xbiblio/csl" prefix="cs"/>
+   <sch:pattern xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:bibo="http://purl.org/ontology/bibo/" xmlns:cs="http://purl.org/net/xbiblio/csl" xmlns="http://relaxng.org/ns/structure/1.0" name="Non-existing macros">
+    
+      <sch:rule context="//cs:text[@macro]">
+      
+         <sch:assert test="@macro = /cs:style/cs:macro/@name">This macro call has no corresponding macro.</sch:assert>
+    
+      </sch:rule>
+    
+      <sch:rule context="//cs:key[@macro]">
+      
+         <sch:assert test="@macro = /cs:style/cs:macro/@name">This macro call has no corresponding macro.</sch:assert>
+    
+      </sch:rule>
+  
+   </sch:pattern>
+   <sch:diagnostics/>
+</sch:schema>

File diff suppressed because it is too large
+ 1512 - 0
app/data/references.yaml


+ 2 - 1
composer.json

@@ -28,7 +28,8 @@
         "sensio/distribution-bundle": "^5.0",
         "sensio/framework-extra-bundle": "^3.0.2",
         "incenteev/composer-parameter-handler": "^2.0",
-        "twig/twig": "^1.0||^2.0"
+        "twig/twig": "^1.0||^2.0",
+        "hasbridge/json-schema-validator": "^0.2.0"
     },
     "require-dev": {
         "sensio/generator-bundle": "^3.0",

+ 43 - 5
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "423b3ad9aec7ff33e89bab160daf662e",
+    "content-hash": "5b85f9879457b763dde10038f062c7c4",
     "packages": [
         {
             "name": "doctrine/annotations",
@@ -775,6 +775,47 @@
             "time": "2016-12-18T15:42:34+00:00"
         },
         {
+            "name": "hasbridge/json-schema-validator",
+            "version": "0.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/hasbridge/php-json-schema.git",
+                "reference": "62b2bb92fe05aca3f81e257cf721fe92dec5a167"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/hasbridge/php-json-schema/zipball/62b2bb92fe05aca3f81e257cf721fe92dec5a167",
+                "reference": "62b2bb92fe05aca3f81e257cf721fe92dec5a167",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.2"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Json": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Harold Asbridge",
+                    "email": "hasbridge@gmail.com"
+                }
+            ],
+            "description": "PHP 5.3 implementation of json schema validation",
+            "homepage": "https://github.com/hasbridge/php-json-schema",
+            "keywords": [
+                "json",
+                "schema"
+            ],
+            "time": "2012-02-27T14:25:05+00:00"
+        },
+        {
             "name": "incenteev/composer-parameter-handler",
             "version": "v2.1.2",
             "source": {
@@ -2096,8 +2137,5 @@
     "platform": {
         "php": ">=5.5.9"
     },
-    "platform-dev": [],
-    "platform-overrides": {
-        "php": "5.5.9"
-    }
+    "platform-dev": []
 }

+ 7 - 3
src/AppBundle/CSL/Factory.php

@@ -13,9 +13,13 @@ class Factory
 {
     public static function create(\DOMElement $dom_node, CiteProc $citeproc = null)
     {
-        $class_name = __NAMESPACE__.'\\'. str_replace('-', '', $dom_node->nodeName);
-        if (class_exists($class_name)) {
-            return new $class_name($dom_node, $citeproc);
+        $className = __NAMESPACE__ . '\\' . implode('', array_map(function ($v) {
+            return ucfirst($v);
+        }, explode('-', $dom_node->nodeName)));
+
+        //$class_name = str_replace('-', '', $dom_node->nodeName);
+        if (class_exists($className)) {
+            return new $className($dom_node, $citeproc);
         } else {
             return null;
         }

+ 13 - 48
src/AppBundle/Command/TestCommand.php

@@ -2,10 +2,11 @@
 
 namespace AppBundle\Command;
 
-use AppBundle\CSL\CiteProc;
+use Json\Validator;
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Yaml\Yaml;
 
 class TestCommand extends ContainerAwareCommand
 {
@@ -26,54 +27,18 @@ class TestCommand extends ContainerAwareCommand
     {
         $container = $this->getContainer();
         $root = $container->get('kernel')->getRootDir();
-        $dir_handle = opendir($root.'/../tests/suite');
-        while (FALSE !== ($filename = readdir($dir_handle))) {
-            if ( !is_dir($root.'/../tests/suite/' . $filename) && $filename[0] != '.') {
-                $json_data = file_get_contents($root.'/../tests/suite/' . $filename);
-                //  $json_data = substr($json_data, strpos($json_data, '*/{')+2);
-                $test_data = json_decode($json_data);
-                switch (json_last_error()) {
-                    case JSON_ERROR_NONE:
-                        echo ' - No errors';
-                        break;
-                    case JSON_ERROR_DEPTH:
-                        echo ' - Maximum stack depth exceeded';
-                        break;
-                    case JSON_ERROR_STATE_MISMATCH:
-                        echo ' - Underflow or the modes mismatch';
-                        break;
-                    case JSON_ERROR_CTRL_CHAR:
-                        echo ' - Unexpected control character found';
-                        break;
-                    case JSON_ERROR_SYNTAX:
-                        echo ' - Syntax error, malformed JSON';
-                        break;
-                    case JSON_ERROR_UTF8:
-                        echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
-                        break;
-                    default:
-                        echo ' - Unknown error';
-                        break;
-                }
+        $schema = $root . '/Resources/schema/csl/csl-data-custom.json';
+        $filename = $root . '/data/references.yaml';
+        $data = Yaml::parse(file_get_contents($filename));
+        $refs = [];
+        $refs['root'] = [];
+        $validator = new Validator($schema);
 
-                if ($test_data->mode == 'bibliography') {
-                    $citeproc = new CiteProc($test_data->csl);
-                    $input_data  = (array)$test_data->input;
-                    $count =  count($input_data);
-                    $output = '';
-                    foreach($input_data as $data) {
-                        $output .= $citeproc->render($data, $test_data->mode);
-                    }
-                    //print '<html><body>';
-                    if ($output != $test_data->result) {
-                        print $root.'/../tests/suite/' . $filename . " FAILED\n";
-                        print $output . " !=  <br>\n" . $test_data->result ."<br><br>\n\n";
-                    }
-                    else {
-                        print $root.'/../tests/suite/' . $filename . " PASSED\n";
-                    }
-                }
-            }
+        foreach ($data['references'] as $ref) {
+            $obj = (object) $ref;
+            $refs['root'][] = $obj;
         }
+        dump($validator->validate($refs['root']));
+
     }
 }

+ 15 - 0
src/AppBundle/Entity/Date.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: loconox
+ * Date: 29/03/2017
+ * Time: 16:16
+ */
+
+namespace AppBundle\Entity;
+
+
+class Date
+{
+
+}

+ 59 - 0
src/AppBundle/Entity/Name.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: loconox
+ * Date: 29/03/2017
+ * Time: 16:08
+ */
+
+namespace AppBundle\Entity;
+
+
+class Name
+{
+
+    /**
+     * @var string
+     */
+    protected $family;
+
+    /**
+     * @var string
+     */
+    protected $given;
+
+    /**
+     * @var string
+     */
+    protected $doppingParticule;
+
+    /**
+     * @var string
+     */
+    protected $nonDroppingParticule;
+
+    /**
+     * @var string
+     */
+    protected $suffix;
+
+    /**
+     * @var string|int|bool
+     */
+    protected $commaSuffix;
+
+    /**
+     * @var string|int|bool
+     */
+    protected $staticOrdering;
+
+    /**
+     * @var string
+     */
+    protected $literal;
+
+    /**
+     * @var string|int|bool
+     */
+    protected $parseNames;
+}

+ 168 - 0
src/AppBundle/Entity/Reference.php

@@ -0,0 +1,168 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: loconox
+ * Date: 29/03/2017
+ * Time: 14:55
+ */
+
+namespace AppBundle\Entity;
+
+
+use Symfony\Component\Validator\Constraints as Assert;
+
+class Reference
+{
+    /**
+     * @var string
+     * @Assert\NotNull()
+     * @Assert\Choice(choices={
+     *     "article",
+     *     "article-journal",
+     *     "article-magazine",
+     *     "article-newspaper",
+     *     "bill",
+     *     "book",
+     *     "broadcast",
+     *     "chapter",
+     *     "dataset",
+     *     "entry",
+     *     "entry-dictionary",
+     *     "entry-encyclopedia",
+     *     "figure",
+     *     "graphic",
+     *     "interview",
+     *     "legal_case",
+     *     "legislation",
+     *     "manuscript",
+     *     "map",
+     *     "motion_picture",
+     *     "musical_score",
+     *     "pamphlet",
+     *     "paper-conference",
+     *     "patent",
+     *     "personal_communication",
+     *     "post",
+     *     "post-weblog",
+     *     "report",
+     *     "review",
+     *     "review-book",
+     *     "song",
+     *     "speech",
+     *     "thesis",
+     *     "treaty",
+     *     "webpage"})
+     */
+    protected $type;
+
+    /**
+     * @var mixed
+     * @Assert\NotNull()
+     */
+    protected $id;
+
+    /**
+     * @var array
+     */
+    protected $categories;
+
+    /**
+     * @var string
+     */
+    protected $language;
+
+    /**
+     * @var string
+     */
+    protected $journalAbbreviation;
+
+    /**
+     * @var string
+     */
+    protected $shortTitle;
+
+    /**
+     * @var Name[]
+     */
+    protected $author;
+
+    /**
+     * @var Name[]
+     */
+    protected $collectionEditor;
+    /**
+     * @var Name[]
+     */
+    protected $composer;
+    /**
+     * @var Name[]
+     */
+    protected $containerAuthor;
+    /**
+     * @var Name[]
+     */
+    protected $director;
+    /**
+     * @var Name[]
+     */
+    protected $editor;
+    /**
+     * @var Name[]
+     */
+    protected $editorialDirector;
+    /**
+     * @var Name[]
+     */
+    protected $interviewer;
+    /**
+     * @var Name[]
+     */
+    protected $illustrator;
+    /**
+     * @var Name[]
+     */
+    protected $originalAuthor;
+    /**
+     * @var Name[]
+     */
+    protected $recipient;
+    /**
+     * @var Name[]
+     */
+    protected $reviewedAuthor;
+    /**
+     * @var Name[]
+     */
+    protected $translator;
+
+    /**
+     * @var Date
+     */
+    protected $accessed;
+
+    protected $container;
+
+    protected $eventDate;
+
+    protected $issued;
+
+    protected $originalDate;
+
+    protected $submitted;
+
+    protected $abstract;
+
+    protected $annote;
+
+    protected $archive;
+
+    protected $archiveLocation;
+
+    protected $archivePlace;
+
+    protected $authority;
+
+    protected $callNumber;
+
+    protected $chapterNumber;
+}

+ 65 - 0
tests/AppBundle/CSL/CiteProcTest.php

@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: loconox
+ * Date: 29/03/2017
+ * Time: 11:46
+ */
+class CiteProcTest
+{
+
+    public function test() {
+        $container = $this->getContainer();
+        $root = $container->get('kernel')->getRootDir();
+        $dir_handle = opendir($root.'/../tests/suite');
+        while (FALSE !== ($filename = readdir($dir_handle))) {
+            if ( !is_dir($root.'/../tests/suite/' . $filename) && $filename[0] != '.') {
+                $json_data = file_get_contents($root.'/../tests/suite/' . $filename);
+                //  $json_data = substr($json_data, strpos($json_data, '*/{')+2);
+                $test_data = json_decode($json_data);
+                switch (json_last_error()) {
+                    case JSON_ERROR_NONE:
+                        echo ' - No errors';
+                        break;
+                    case JSON_ERROR_DEPTH:
+                        echo ' - Maximum stack depth exceeded';
+                        break;
+                    case JSON_ERROR_STATE_MISMATCH:
+                        echo ' - Underflow or the modes mismatch';
+                        break;
+                    case JSON_ERROR_CTRL_CHAR:
+                        echo ' - Unexpected control character found';
+                        break;
+                    case JSON_ERROR_SYNTAX:
+                        echo ' - Syntax error, malformed JSON';
+                        break;
+                    case JSON_ERROR_UTF8:
+                        echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
+                        break;
+                    default:
+                        echo ' - Unknown error';
+                        break;
+                }
+
+                if ($test_data->mode == 'bibliography') {
+                    $citeproc = new CiteProc($test_data->csl);
+                    $input_data  = (array)$test_data->input;
+                    $count =  count($input_data);
+                    $output = '';
+                    foreach($input_data as $data) {
+                        $output .= $citeproc->render($data, $test_data->mode);
+                    }
+                    //print '<html><body>';
+                    if ($output != $test_data->result) {
+                        print $root.'/../tests/suite/' . $filename . " FAILED\n";
+                        print $output . " !=  <br>\n" . $test_data->result ."<br><br>\n\n";
+                    }
+                    else {
+                        print $root.'/../tests/suite/' . $filename . " PASSED\n";
+                    }
+                }
+            }
+        }
+    }
+}