Example #1
0
len(list(ReadOnlyGraphAggregate([g1, g2]).subjects(RDF.type, RDF.Statement)))
print(list(ReadOnlyGraphAggregate([g1, g2]).subjects(RDF.type, RDF.Statement)))

uniqueGraphNames = set([
    graph.identifier
    for s, p, o, graph in ConjunctiveGraph(store).quads((None, RDF.predicate,
                                                         None))
])

print(uniqueGraphNames)

unionGraph = ReadOnlyGraphAggregate([g1, g2])

uniqueGraphNames = set([
    graph.identifier
    for s, p, o, graph in unionGraph.quads((None, RDF.predicate, None))
])

print(uniqueGraphNames)

RDFLib = Namespace('http://rdflib.net/')

RDFLib.gswewf
#rdflib.term.URIRef('http://rdflib.net/gswewf')

RDFLib['中文']
#rdflib.term.URIRef('http://rdflib.net/中文')

rr = ResultRow({Variable('a'): URIRef('urn:cake')}, [Variable('a')])
rr[0]
#rdflib.term.URIRef(u'urn:cake')
Example #2
0
len(list(ConjunctiveGraph(store).subjects(RDF.type, RDF.Statement)))
print(list(ConjunctiveGraph(store).subjects(RDF.type, RDF.Statement)))
len(list(ReadOnlyGraphAggregate([g1,g2]).subjects(RDF.type, RDF.Statement)))
print(list(ReadOnlyGraphAggregate([g1,g2]).subjects(RDF.type, RDF.Statement)))


uniqueGraphNames = set(
     [graph.identifier for s, p, o, graph in ConjunctiveGraph(store
   ).quads((None, RDF.predicate, None))])

print(uniqueGraphNames)

unionGraph = ReadOnlyGraphAggregate([g1, g2])

uniqueGraphNames = set(
 [graph.identifier for s, p, o, graph in unionGraph.quads(
  (None, RDF.predicate, None))])

print(uniqueGraphNames)


RDFLib = Namespace('http://rdflib.net/')

RDFLib.gswewf
#rdflib.term.URIRef('http://rdflib.net/gswewf')

RDFLib['中文']
#rdflib.term.URIRef('http://rdflib.net/中文')


rr=ResultRow({ Variable('a'): URIRef('urn:cake') }, [Variable('a')])
rr[0]