diff --git a/rdf/RDF.ipynb b/rdf/RDF.ipynb index e4917af..beccd4c 100644 --- a/rdf/RDF.ipynb +++ b/rdf/RDF.ipynb @@ -318,45 +318,9 @@ "\n", "```\n", "# YOUR ANSWER HERE\n", - "```" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": false, - "editable": false, - "nbgrader": { - "checksum": "61933311e76dd200b63032f42f26b11d", - "grade": false, - "grade_id": "cell-da88c2f8170436fe", - "locked": true, - "schema_version": 1, - "solution": false - } - }, - "source": [ - "Turtle is usually written in standalone files (e.g. `mydefinition.ttl`).\n", - "To write Turtle definitions inside our notebook, and to make it easy to test them, we will use a special magic command: `%%ttl`.\n", - "\n", - "To make sure everything works, let's try first with an example.\n", - "\n", - "\n", - "Copy/paste this solution below:\n", - "\n", - "```turtle\n", - "@prefix foaf: .\n", - "@prefix geo: .\n", - "@prefix rdf: .\n", + "```\n", "\n", - " \n", - " a foaf:Person;\n", - " foaf:interest ;\n", - " foaf:based_near [\n", - " geo:lat \"34.0736111\" ;\n", - " geo:lon \"-118.3994444\"\n", - " ] .\n", - "```" + "Execute the following line. It simple fills 'example' with the code written below. It should produce the output 'File loaded!\"." ] }, { @@ -425,6 +389,76 @@ "print('All tests passed. Well done!')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now replace #YOUR ANSWER HERE with your answer (the triples) and execute the test." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%ttl example\n", + "# YOUR ANSWER HERE" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# This code tests that the definition above is correct.\n", + "g = solution('example')\n", + "test('Some triples have been loaded',\n", + " len(g))\n", + "test('A person has been defined',\n", + " g.subjects(RDF.type, term.URIRef('http://xmlns.com/foaf/0.1/Person')))\n", + "print('All tests passed. Well done!')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": false, + "editable": false, + "nbgrader": { + "checksum": "61933311e76dd200b63032f42f26b11d", + "grade": false, + "grade_id": "cell-da88c2f8170436fe", + "locked": true, + "schema_version": 1, + "solution": false + } + }, + "source": [ + "Turtle is usually written in standalone files (e.g. `mydefinition.ttl`).\n", + "To write Turtle definitions inside our notebook, and to make it easy to test them, we will use a special magic command: `%%ttl`.\n", + "\n", + "To make sure everything works, let's try first with an example.\n", + "\n", + "\n", + "Copy/paste this solution below:\n", + "\n", + "```turtle\n", + "@prefix foaf: .\n", + "@prefix geo: .\n", + "@prefix rdf: .\n", + "\n", + " \n", + " a foaf:Person;\n", + " foaf:interest ;\n", + " foaf:based_near [\n", + " geo:lat \"34.0736111\" ;\n", + " geo:lon \"-118.3994444\"\n", + " ] .\n", + "```" + ] + }, { "cell_type": "markdown", "metadata": { @@ -975,7 +1009,24 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.5.5" + }, + "latex_envs": { + "LaTeX_envs_menu_present": true, + "autocomplete": true, + "bibliofile": "biblio.bib", + "cite_by": "apalike", + "current_citInitial": 1, + "eqLabelWithNumbers": true, + "eqNumInitial": 1, + "hotkeys": { + "equation": "Ctrl-E", + "itemize": "Ctrl-I" + }, + "labels_anchors": false, + "latex_user_defs": false, + "report_style_numbering": false, + "user_envs_cfg": false } }, "nbformat": 4,