Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging data within dynamically added script tags #5

Open
timathom opened this issue Jul 13, 2015 · 2 comments
Open

Merging data within dynamically added script tags #5

timathom opened this issue Jul 13, 2015 · 2 comments

Comments

@timathom
Copy link

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 calling GreenTurtle.attach(document). Is it possible to do the same with embedded Turtle that has been dynamically added after the initial page load?

@alexmilowski
Copy link
Owner

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)

@timathom
Copy link
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants