This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rdflib | |
DOCUMENT = """ | |
@base <local:> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
<class_to_class> | |
a | |
rdfs:Class , | |
<Category> ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Question about importing JSON-LD @included contents. | |
Published at: | |
https://gist.github.com/anatoly-scherbakov/d5ddeb6a0a8651ba5d148aa36a752699 | |
This is supplementary material for this GitHub issue: | |
https://github.com/RDFLib/rdflib-jsonld/issues/98 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Question about importing JSON-LD @graph contents into a named graph with | |
specifically provided IRI instead of an IRI taken from the @id. | |
Published at: | |
https://gist.github.com/anatoly-scherbakov/e1c75db34a262f7aa107d82399c50c52 | |
This is supplementary material for this StackOverflow question: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Import JSON-LD document into RDFLib graph. | |
The schema of @base IRI can lead RDFLib to silently refuse the import. | |
This is supplementary code for: https://github.com/RDFLib/rdflib-jsonld/issues/97 | |
""" | |
import json | |
import textwrap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Test JSON-LD expand operation in PyLD. | |
Supplementary code for https://github.com/digitalbazaar/pyld/issues/143 | |
""" | |
import json | |
from pyld import jsonld |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Generic, TypeVar | |
from pydantic import ValidationError | |
from pydantic.fields import ModelField | |
T = TypeVar('T') | |
class CommaSeparatedList(Generic[T]): | |
"""Parse and validate a list of comma separated values.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
get_concurrency="aws lambda get-function-concurrency --function-name {} | jq -r '\"{.},\( .ReservedConcurrentExecutions )\"'" | |
tmpfile=$(tempfile) || exit | |
aws lambda list-functions \ | |
| jq -r '.Functions[] .FunctionName' \ | |
| parallel "$get_concurrency" > ${tmpfile} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dataclasses | |
from datetime import datetime | |
from typing import Optional, Dict, Iterable | |
@dataclasses.dataclass(frozen=True) | |
class Memento: | |
original_url: str | |
time: datetime | |
archived_headers_cid: str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import functools | |
from typing import Iterator | |
import datetime | |
from dateutil.relativedelta import relativedelta | |
def month_range( | |
start: datetime.date, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert | |
$jedi isa order, has name "Jedi"; | |
$sith isa order, has name "Sith"; | |
# Okay, let's start with some Jedi masters we know of. | |
$obi-wan isa human, has name "Obi-Wan Kenobi", has gender "male"; | |
$obi-wan-is-jedi (member: $obi-wan, member-of: $jedi) isa membership; | |
# What do we know about Anakin? |