@@ -6,10 +6,7 @@ use oxrdf::{
66 vocab:: { rdf, rdfs} ,
77} ;
88
9- use crate :: {
10- host_language:: Html5 ,
11- vocab:: { owl, rdfa} ,
12- } ;
9+ use crate :: vocab:: { owl, rdfa} ;
1310
1411pub trait VocabularyResolver {
1512 fn resolve ( & self , vocab_iri : & str ) -> Option < Cow < ' _ , Graph > > ;
@@ -23,12 +20,12 @@ impl<T: VocabularyResolver> VocabularyResolver for &T {
2320
2421/// Allows resolving vocabularies by fetching their target IRIs
2522/// over HTTP(S).
26- #[ cfg( feature = "http " ) ]
23+ #[ cfg( feature = "vocab-online " ) ]
2724pub struct OnlineVocabularyResolver {
2825 client : reqwest:: blocking:: Client ,
2926}
3027
31- #[ cfg( feature = "http " ) ]
28+ #[ cfg( feature = "vocab-online " ) ]
3229impl Default for OnlineVocabularyResolver {
3330 fn default ( ) -> Self {
3431 Self {
@@ -38,8 +35,9 @@ impl Default for OnlineVocabularyResolver {
3835}
3936
4037// yo dawg
38+ #[ cfg( feature = "html" ) ]
4139fn vocab_from_html ( html : & str , base : Iri < & str > ) -> Graph {
42- let ( o_graph, ( ) ) = crate :: doc_to_graphs :: < Html5 , ( ) > (
40+ let ( o_graph, ( ) ) = crate :: doc_to_graphs :: < crate :: host_language :: Html5 , ( ) > (
4341 html,
4442 base. as_ref ( ) ,
4543 crate :: Options :: default ( ) , // we explicitly do _not_ enable expansion on vocabularies
@@ -48,7 +46,7 @@ fn vocab_from_html(html: &str, base: Iri<&str>) -> Graph {
4846 o_graph
4947}
5048
51- #[ cfg( feature = "http " ) ]
49+ #[ cfg( feature = "vocab-online " ) ]
5250impl VocabularyResolver for OnlineVocabularyResolver {
5351 fn resolve ( & self , vocab_iri : & str ) -> Option < Cow < ' _ , Graph > > {
5452 use tracing:: debug;
@@ -79,16 +77,19 @@ impl VocabularyResolver for OnlineVocabularyResolver {
7977/// Allows resolving vocabularies through a preloaded
8078/// set of vocabulary documents, for offline processing.
8179#[ derive( Default ) ]
80+ #[ cfg( feature = "html" ) ]
8281pub struct OfflineVocabularyResolver {
8382 vocabularies : std:: collections:: HashMap < String , Graph > ,
8483}
8584
85+ #[ cfg( feature = "html" ) ]
8686impl VocabularyResolver for OfflineVocabularyResolver {
8787 fn resolve ( & self , vocab_iri : & str ) -> Option < Cow < ' _ , Graph > > {
8888 self . vocabularies . get ( vocab_iri) . map ( Cow :: Borrowed )
8989 }
9090}
9191
92+ #[ cfg( feature = "html" ) ]
9293impl OfflineVocabularyResolver {
9394 pub fn insert ( & mut self , vocab_iri : String , graph : Graph ) {
9495 self . vocabularies . insert ( vocab_iri, graph) ;
0 commit comments