是否有任何地方(例如对象VDS.RDF.Ontology
)保存集成在 OpenLink Virtuoso 实例中的本体列表(及其属性和类)?
我在C#
(我使用dotNetRDF
)中编程并且我犹豫是否使用查询来获取此信息。
有什么建议么?
In the RDF universe, an ontology is just another graph; each graph should be self-describing; and each ontology graph should therefore include a statement that basically says "I'm an ontology."
Presuming such best practices have been followed, you can use a query like this to get a list of ontology named graphs that are described behind a given endpoint --
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?ontology
WHERE { ?ontology rdf:type owl:Ontology }
ORDER BY ?ontology
Note however that it is not necessary for an Ontology graph to be loaded into Virtuoso (or other quad/triple/RDF store) in order for that ontology's terms to be used in other graphs loaded into that store, so I wonder at the purpose of your question...
ETA: Given that you have a list of named graphs for the ontologies in a given instance, you can get their content with queries like this --
SELECT *
FROM <http://purl.org/vocab/relationship/>
WHERE { ?s ?p ?o }
-- which you can execute through an ADO.NET connection from C#, through the Virtuoso ADO.NET Provider, by turning it into SPARQL-in-SQL a/k/a SPASQL with the simple prepending of the SPARQL keyword and appending of a semicolon --
SPARQL
SELECT *
FROM <http://purl.org/vocab/relationship/>
WHERE { ?s ?p ?o } ;
It may now go without saying, but to be clear -- you can also issue the initially described query as SPASQL via ADO.NET --
SPARQL
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?ontology
WHERE { ?ontology rdf:type owl:Ontology }
ORDER BY ?ontology ;
(ObDisclaimer: I work for OpenLink Software, producer of Virtuoso.)