Open timathom opened 9 years ago
The turtle is automatically detected and loaded into the graph. If you dynamically add a script element, you just need to call attached again:
document.data.implementation.attach(document)
or
GreenTurtle.attach(document)
Thanks, that's what I thought. My problem seems to have been with DBpedia's default Turtle output, which interweaves prefixes and triples. For example, querying http://dbpedia.org/sparql
with
DESCRIBE <http://dbpedia.org/resource/Turtle_(syntax)> WHERE {<http://dbpedia.org/resource/Turtle_(syntax)> ?p ?o} ORDER BY ?p LIMIT 1
results in output like this:
@prefix dbpprop: <http://dbpedia.org/property/> .
<http://dbpedia.org/resource/TriG_(syntax)> dbpprop:extendedFrom <http://dbpedia.org/resource/Turtle_(syntax)> .
@prefix dbpedia-owl: <http://dbpedia.org/ontology/> .
<http://dbpedia.org/resource/Turtle_(disambiguation)> dbpedia-owl:wikiPageDisambiguates <http://dbpedia.org/resource/Turtle_(syntax)> .
@prefix ns2: <http://www.w3.org/2006/03/wn/wn20/instances/> .
<http://dbpedia.org/resource/Turtle_(syntax)> dbpprop:wordnet_type ns2:synset-format-noun-1 .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://dbpedia.org/resource/Turtle_(syntax)> owl:sameAs <http://rdf.freebase.com/ns/m.0gkp12> ,
<http://es.dbpedia.org/resource/Turtle_(sintaxis)> .
The parser throws the following errors:
2: No prefix mapping for dbpprop
2: Terminating: Cannot parse predicate IRI.
2: Missing end . triples. Found: ...
DBpedia does offer a pretty-printed Turtle serialization (which they qualify as "slow!"), but this "alternative" format doesn't have a standard MIME type that can be requested (as far as I can tell).
I am trying to integrate Green Turtle with an XForms application (XSLTForms) and would like to be able to merge Turtle data that has been dynamically loaded within an embedded
<script type="text/turtle">
tag. With RDFa-encoded data, it's possible to update the default graph by callingGreenTurtle.attach(document)
. Is it possible to do the same with embedded Turtle that has been dynamically added after the initial page load?