A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/RDFLib/rdflib/commit/4b96e9d below:

Don't use `publicID` as the name for the default gra… · RDFLib/rdflib@4b96e9d · GitHub

@@ -1400,26 +1400,26 @@ def parse(

1400 1400

:doc:`Security Considerations </security_considerations>`

1401 1401

documentation.

1402 1402 1403 -

:Parameters:

1404 - 1405 -

- ``source``: An InputSource, file-like object, or string. In the case

1406 -

of a string the string is the location of the source.

1407 -

- ``location``: A string indicating the relative or absolute URL of

1408 -

the source. Graph's absolutize method is used if a relative location

1403 +

:param source: An `InputSource`, file-like object, `Path` like object,

1404 +

or string. In the case of a string the string is the location of the

1405 +

source.

1406 +

:param location: A string indicating the relative or absolute URL of the

1407 +

source. `Graph`'s absolutize method is used if a relative location

1409 1408

is specified.

1410 -

- ``file``: A file-like object.

1411 -

- ``data``: A string containing the data to be parsed.

1412 -

- ``format``: Used if format can not be determined from source, e.g.

1409 +

:param file: A file-like object.

1410 +

:param data: A string containing the data to be parsed.

1411 +

:param format: Used if format can not be determined from source, e.g.

1413 1412

file extension or Media Type. Defaults to text/turtle. Format

1414 1413

support can be extended with plugins, but "xml", "n3" (use for

1415 1414

turtle), "nt" & "trix" are built in.

1416 -

- ``publicID``: the logical URI to use as the document base. If None

1415 +

:param publicID: the logical URI to use as the document base. If None

1417 1416

specified the document location is used (at least in the case where

1418 -

there is a document location).

1419 - 1420 -

:Returns:

1421 - 1422 -

- self, the graph instance.

1417 +

there is a document location). This is used as the base URI when

1418 +

resolving relative URIs in the source document, as defined in `IETF

1419 +

RFC 3986

1420 +

<https://datatracker.ietf.org/doc/html/rfc3986#section-5.1.4>`_,

1421 +

given the source document does not define a base URI.

1422 +

:return: ``self``, i.e. the :class:`~rdflib.graph.Graph` instance.

1423 1423 1424 1424

Examples:

1425 1425

@@ -2206,15 +2206,18 @@ def parse(

2206 2206

**args: Any,

2207 2207

) -> "Graph":

2208 2208

"""

2209 -

Parse source adding the resulting triples to its own context

2210 -

(sub graph of this graph).

2209 +

Parse source adding the resulting triples to its own context (sub graph

2210 +

of this graph).

2211 2211 2212 2212

See :meth:`rdflib.graph.Graph.parse` for documentation on arguments.

2213 2213 2214 +

If the source is in a format that does not support named graphs it's triples

2215 +

will be added to the default graph (i.e. `Dataset.default_context`).

2216 + 2214 2217

:Returns:

2215 2218 2216 -

The graph into which the source was parsed. In the case of n3

2217 -

it returns the root context.

2219 +

The graph into which the source was parsed. In the case of n3 it returns

2220 +

the root context.

2218 2221 2219 2222

.. caution::

2220 2223

@@ -2228,6 +2231,14 @@ def parse(

2228 2231

For information on available security measures, see the RDFLib

2229 2232

:doc:`Security Considerations </security_considerations>`

2230 2233

documentation.

2234 + 2235 +

*Changed in 7.0*: The ``publicID`` argument is no longer used as the

2236 +

identifier (i.e. name) of the default graph as was the case before

2237 +

version 7.0. In the case of sources that do not support named graphs,

2238 +

the ``publicID`` parameter will also not be used as the name for the

2239 +

graph that the data is loaded into, and instead the triples from sources

2240 +

that do not support named graphs will be loaded into the default graph

2241 +

(i.e. `ConjunctionGraph.default_context`).

2231 2242

"""

2232 2243 2233 2244

source = create_input_source(

@@ -2246,12 +2257,8 @@ def parse(

2246 2257

# create_input_source will ensure that publicId is not None, though it

2247 2258

# would be good if this guarantee was made more explicit i.e. by type

2248 2259

# hint on InputSource (TODO/FIXME).

2249 -

g_id: str = publicID and publicID or source.getPublicId()

2250 -

if not isinstance(g_id, Node):

2251 -

g_id = URIRef(g_id)

2252 2260 2253 -

context = Graph(store=self.store, identifier=g_id)

2254 -

context.remove((None, None, None)) # hmm ?

2261 +

context = self.default_context

2255 2262

context.parse(source, publicID=publicID, format=format, **args)

2256 2263

# TODO: FIXME: This should not return context, but self.

2257 2264

return context

@@ -2459,6 +2466,14 @@ def parse(

2459 2466

**args: Any,

2460 2467

) -> "Graph":

2461 2468

"""

2469 +

Parse an RDF source adding the resulting triples to the Graph.

2470 + 2471 +

See :meth:`rdflib.graph.Graph.parse` for documentation on arguments.

2472 + 2473 +

The source is specified using one of source, location, file or data.

2474 + 2475 +

If the source is in a format that does not support named graphs it's triples

2476 +

will be added to the default graph (i.e. `Dataset.default_context`).

2462 2477 2463 2478

.. caution::

2464 2479

@@ -2472,6 +2487,14 @@ def parse(

2472 2487

For information on available security measures, see the RDFLib

2473 2488

:doc:`Security Considerations </security_considerations>`

2474 2489

documentation.

2490 + 2491 +

*Changed in 7.0*: The ``publicID`` argument is no longer used as the

2492 +

identifier (i.e. name) of the default graph as was the case before

2493 +

version 7.0. In the case of sources that do not support named graphs,

2494 +

the ``publicID`` parameter will also not be used as the name for the

2495 +

graph that the data is loaded into, and instead the triples from sources

2496 +

that do not support named graphs will be loaded into the default graph

2497 +

(i.e. `ConjunctionGraph.default_context`).

2475 2498

"""

2476 2499 2477 2500

c = ConjunctiveGraph.parse(


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4