-
Notifications
You must be signed in to change notification settings - Fork 542
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
How to generate a standard ontology title? #2643
Comments
But in Turtle syntax the I don't think there is a way to unbind a prefix from the NamespaceManager, which automatically binds some 'core prefixes': rdflib/rdflib/namespace/__init__.py Lines 463 to 464 in ce7e414
Either pick a different serialization format (e.g. nt), or write your own custom NamespaceManager. But keep in mind that the |
Is this what you want? from rdflib import Graph, URIRef, Literal, RDF, OWL, DC
graph = Graph()
graph.namespace_manager.bind("rdfs", None, replace=True)
rdfs = URIRef("http://www.w3.org/2000/01/rdf-schema#")
graph.add((
rdfs, RDF.type, OWL.Ontology
))
graph.add((
rdfs, DC.title, Literal("The RDF Schema vocabulary (RDFS)")
))
graph.print() Output: @prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://www.w3.org/2000/01/rdf-schema#> a owl:Ontology ;
dc:title "The RDF Schema vocabulary (RDFS)" . Looks like binding an existing prefix with |
Thank you!
…On Tue, Dec 12, 2023 at 6:24 PM Edmond Chuc ***@***.***> wrote:
Is this what you want?
from rdflib import Graph, URIRef, Literal, RDF, OWL, DC
graph = Graph()graph.namespace_manager.bind("rdfs", None, replace=True)
rdfs = URIRef("http://www.w3.org/2000/01/rdf-schema#")
graph.add((
rdfs, RDF.type, OWL.Ontology
))graph.add((
rdfs, DC.title, Literal("The RDF Schema vocabulary (RDFS)")
))
graph.print()
Output:
@Prefix dc: <http://purl.org/dc/elements/1.1/> .@Prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://www.w3.org/2000/01/rdf-schema#> a owl:Ontology ;
dc:title "The RDF Schema vocabulary (RDFS)" .
Looks like binding an existing prefix with None with the optional
replace=True will "unbind" the prefix.
—
Reply to this email directly, view it on GitHub
<#2643 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOTAUAZ4QFSG6K67DSLUSXTYJDRT5AVCNFSM6AAAAAA7LSFMRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJSHE4TCNJVGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
BOB BUCK
SENIOR PLATFORM SOFTWARE ENGINEER
SKIDMORE, OWINGS & MERRILL
7 WORLD TRADE CENTER
250 GREENWICH STREET
NEW YORK, NY 10007
T (212) 298-9624
***@***.***
|
How do you generate this EXACT text using the library?
I have tried all sorts of incantations and I can't get it to work. It either generates URI Refs in quotes (no angle brackets), or it simply emits "rdfs:", no URI.
The text was updated successfully, but these errors were encountered: