Namespaces with #

59 views
Skip to first unread message

Kristina

unread,
Aug 1, 2019, 8:56:54 AM8/1/19
to rdflib-dev
Hello,

my ontology is written in JSON-LD. I use RDFLib to parse it and prepared Query for SPARQL. So far, it works fine.

But then I analyzed the SPARQL results and noticed that the namespace was "manipulated" by RDFLib. For example, in the ontology an instance is defined as "http://my-ontology-space#mySubject" and in the SPARQL results was "http://my-ontology-space/#mySubject'}". Not only in SPARQL, but also by printing the entire graph.

Where the "/" comes from?

I used an ontology IRI (spoken in Protege terms) defined as:
{
"@id" : "http://my-ontology-space",
"@type" : [ "http://www.w3.org/2002/07/owl#Ontology" ],....}

And I also tried with "http://my-ontology-space#", unfortunately with the same result.

There is also a problem with DatatypeProperty. This results in "http://my-ontology-space/.#topic", even it defined in the ontology as:

{
"@id" : "http://my-ontology-space#topic",
"@type" : [ "http://www.w3.org/2002/07/owl#DatatypeProperty" ]
}

Interesting, that imported ontologies using # (e.g. "http://www.w3.org/2002/07/owl#NamedIndividual") are not "manipulated" by RDFlib.

However, the namespace with # is not recognized correctly during the graph parsing.

g = Graph()
g.parse("temp.owl", format="json-ld")
for s, p, o in g:
print (s, p, o)

Is there any workaround? Bugfix or feature?
Again, where the "/" and "/." comes from?
How is it possible to use namespaces/prefixes with ending #?

Thank you for any advice!
Kristina

Sergio Fernández

unread,
Aug 1, 2019, 9:01:42 AM8/1/19
to rdfli...@googlegroups.com
What do you have defined as @base?


That would be used by RDFLib to parse your file.


--
http://github.com/RDFLib
---
You received this message because you are subscribed to the Google Groups "rdflib-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rdflib-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rdflib-dev/a3fea92b-0be5-4084-9190-cbba8053c722%40googlegroups.com.
Message has been deleted

kristina...@gmx.de

unread,
Aug 2, 2019, 3:56:37 AM8/2/19
to rdflib-dev
> To unsubscribe from this group and stop receiving emails from it, send an email to rdfli...@googlegroups.com.
Protegé generates only an expanded version of JSON-LD. Thus, there is no @base and no context defined. It looks like in example 27 on
https://w3c.github.io/json-ld-syntax/#example-27-using-as-the-vocabulary-mapping-expanded

I would expect it working.

Kristina

unread,
Aug 6, 2019, 4:05:24 AM8/6/19
to rdflib-dev
Am Donnerstag, 1. August 2019 15:01:42 UTC+2 schrieb Sergio Fernández:
> To unsubscribe from this group and stop receiving emails from it, send an email to rdfli...@googlegroups.com.
Hi Sergio,

here is an update: I did some tests using https://json-ld.org/playground/ to create different formats of JSON-LD(expanded, compacted, flattened) and RDFlib for SPARQL query (https://rdflib.readthedocs.io/en/stable/intro_to_sparql.html).
The result is my tests: the namespace is not recognized well in expanded JSON-LD (see my first post); no results returned in compacted and flattened JSON-LD files with defined context.

It seems to be a bug in RDFLib or do you have any working examples or further tipps for me?

Thanks!






Sergio Fernández

unread,
Aug 6, 2019, 9:52:29 AM8/6/19
to rdfli...@googlegroups.com
Then, if it looks like a bug, report it to GitHub.

To unsubscribe from this group and stop receiving emails from it, send an email to rdflib-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rdflib-dev/fe39d9fc-d407-45b3-b341-5d12d08de90a%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages