diff --git a/lib/RdfaParser.ts b/lib/RdfaParser.ts index 0a81a66..de74f52 100644 --- a/lib/RdfaParser.ts +++ b/lib/RdfaParser.ts @@ -124,6 +124,8 @@ export class RdfaParser extends Transform implements RDF.Sink this.emitPrefix(prefix, suffix)); activeTag.prefixesAll = Object.keys(activeTag.prefixesCustom).length > 0 ? { ...parentTag.prefixesAll, ...activeTag.prefixesCustom } : parentTag.prefixesAll; @@ -782,6 +784,18 @@ export class RdfaParser extends Transform implements RDF.Sink void): {[prefix: string]: string} { const additionalPrefixes: {[prefix: string]: string} = {}; if (xmlnsPrefixMappings) { for (const attribute in attributes) { if (attribute.startsWith('xmlns')) { + cb?.(attribute.substr(6), attributes[attribute]) additionalPrefixes[attribute.substr(6)] = attributes[attribute]; } } @@ -67,6 +69,7 @@ export class Util { let prefixMatch; // tslint:disable-next-line:no-conditional-assignment while (prefixMatch = Util.PREFIX_REGEX.exec(attributes.prefix)) { + cb?.(prefixMatch[1], prefixMatch[2]); prefixes[prefixMatch[1]] = prefixMatch[2]; } } diff --git a/test/RdfParser-test.ts b/test/RdfParser-test.ts index 0c26409..d1005a6 100644 --- a/test/RdfParser-test.ts +++ b/test/RdfParser-test.ts @@ -175,3922 +175,3943 @@ describe('RdfaParser', () => { }); describe('should parse', () => { - it('an empty document', async () => { - return expect(await parse(parser, ``)) - .toBeRdfIsomorphic([]); - }); - - it('property attributes to predicates', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), - ]); - }); - - it('multi-line strings', async () => { - return expect(await parse(parser, ` - - -

The -Trouble -with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://purl.org/dc/terms/title', '"The\nTrouble\nwith Bob"'), - ]); - }); - - it('absolute about attributes to subjects', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example2.org/', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), - ]); - }); - - it('relative about attributes to subjects', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/img.jpg', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), - ]); - }); - - it('blank node about attributes to subjects', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), - ]); - }); - - it('content attributes to objects', async () => { - return expect(await parse(parser, ` - - -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://purl.org/dc/terms/title', 'http://example.org/img.jpg'), - ]); - }); - - it('prefixes and expand them', async () => { - return expect(await parse(parser, ` - - -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://purl.org/dc/terms/title', 'http://example.org/img.jpg'), - ]); - }); - - it('property with default prefix and expand them', async () => { - return expect(await parse(parser, ` - - -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://www.w3.org/1999/xhtml/vocab#title', 'http://example.org/img.jpg'), - ]); - }); - - it('base tags and set the baseIRI', async () => { - const output = await parse(parser, ` - - - - -
- -`); - expect(output).toBeRdfIsomorphic([ - quad('http://base.com/', 'http://purl.org/dc/terms/title', 'http://base.com/img.jpg'), - ]); - return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://base.com/')); - }); - - it('base tags are ignored when features.baseTag is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - const output = await parse(parser, ` - - - - -
- -`); - expect(output).toBeRdfIsomorphic([ - quad('http://example.org/', 'http://purl.org/dc/terms/title', 'http://example.org/img.jpg'), - ]); - return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://example.org/')); - }); - - it('base tags with fragment and set the baseIRI', async () => { - const output = await parse(parser, ` - - - - -
- -`); - expect(output).toBeRdfIsomorphic([ - quad('http://base.com/', 'http://purl.org/dc/terms/title', 'http://base.com/img.jpg'), - ]); - return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://base.com/')); - }); - - it('base tags without href and not set the baseIRI', async () => { - await parse(parser, ` - - - - -
- -`); - return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://example.org/')); - }); - - it('typeof with about', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Document'), - ]); - }); - - it('empty typeof with defined vocab', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - ]); - }); - - it('typeofs with about', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Document1'), - quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Document2'), - ]); - }); - - it('typeof with resource', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Document'), - ]); - }); - - it('typeof with about and resource', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#myDoc1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Document'), - ]); - }); - - it('typeof without about and resource', async () => { - return expect(await parse(parser, ` - - -

The Trouble with Bob

- -`)) - .toBeRdfIsomorphic([ - quad('_:b', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Document'), - ]); - }); - - it('typeof without about and resource and children', async () => { - return expect(await parse(parser, ` - - -
- Albert Einstein - Albert -
- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://schema.org/Person'), - quad('_:b1', 'http://schema.org/name', '"Albert Einstein"'), - quad('_:b1', 'http://schema.org/givenName', '"Albert"'), - ]); - }); - - it('rel and href as resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), - ]); - }); - - it('rel on root tag', async () => { - return expect(await parse(parser, ` - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), - ]); - }); - - it('rel and href as resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/s', 'http://example.org/p', 'http://example.org/o'), - quad('http://example.org/s', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://example.org/Type'), - ]); - }); - - it('rel and resource as resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), - ]); - }); - - it('rel (2x) and resource as resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://example.org/p1', 'http://example.org/o'), - quad('http://example.org/', 'http://example.org/p2', 'http://example.org/o'), - ]); - }); - - it('rel and src as resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), - ]); - }); - - it('rev and href as reverse resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/o', 'http://example.org/p', 'http://example.org/'), - ]); - }); - - it('rev and resource as reverse resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/o', 'http://example.org/p', 'http://example.org/'), - ]); - }); - - it('rev and src as reverse resource link', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/o', 'http://example.org/p', 'http://example.org/'), - ]); - }); - - it('rel, rev and src as reverse resource links', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://example.org/p1', 'http://example.org/o'), - quad('http://example.org/o', 'http://example.org/p2', 'http://example.org/'), - ]); - }); - - it('resource should be prioritized over href', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', 'http://example.org/p', 'http://example.org/o1'), - ]); - }); - - it('complex combinations of about, rel, rev and href', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

- This photo was taken by - Mark Birbeck. -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/photo1.jpg', - 'http://purl.org/dc/elements/1.1/creator', - 'http://www.blogger.com/profile/1109404'), - quad('http://www.blogger.com/profile/1109404', - 'http://xmlns.com/foaf/0.1/img', - 'http://example.org/photo1.jpg'), - ]); - }); - - it('content attributes', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/photo1.jpg', - 'http://purl.org/dc/elements/1.1/title', - '"Portrait of Mark"'), - ]); - }); - - it('content that overrides text content', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/photo1.jpg', - 'http://purl.org/dc/elements/1.1/title', - '"Portrait of Mark"'), - ]); - }); - - it('nested text content', async () => { - return expect(await parse(parser, ` - - - -
- John - Doe -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/foaf#me', - 'http://xmlns.com/foaf/0.1/familyName', - '"Doe"'), - quad('http://example.org/foaf#me', - 'http://xmlns.com/foaf/0.1/givenName', - '"John"'), - quad('http://example.org/foaf#me', - 'http://xmlns.com/foaf/0.1/name', - '"\n John\n Doe\n "'), - ]); - }); - - it('inline nested text content', async () => { - // tslint:disable:max-line-length - return expect(await parse(parser, ` - - - -
John Doe
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/foaf#me', - 'http://xmlns.com/foaf/0.1/familyName', - '"Doe"'), - quad('http://example.org/foaf#me', - 'http://xmlns.com/foaf/0.1/givenName', - '"John"'), - quad('http://example.org/foaf#me', - 'http://xmlns.com/foaf/0.1/name', - '"John Doe"'), - ]); - // tslint:enable:max-line-length - }); - - it('datatype to set the object literal datatype', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

3

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"3"^^http://www.w3.org/2001/XMLSchema#integer'), - ]); - }); - - it('datatype to set the object literal datatype for content attributes', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"3"^^http://www.w3.org/2001/XMLSchema#integer'), - ]); - }); - - it('datatype to set the object literal datatype with strings in a nested tag', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Mark Birbeck"'), - ]); - }); - - it('datatype to set the object literal datatype with strings in nested tags', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Mark Birbeck"'), - ]); - }); - - it('rdf:XMLLiteral datatype to preserve all nested tags', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Mark' + - ' ' + - 'Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), - ]); - }); - - it('rdf:XMLLiteral datatype to preserve all nested tags without xmlns and prefixes', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/terms/title', - '"Mark Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), - ]); - }); - - it('rdf:XMLLiteral datatype to inherit all xmlns and prefixes', async () => { - const attrs = 'xmlns="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" ' + - 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"'; - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - `"Mark Birbeck"` - + '^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), - ]); - }); - - it('rdf:XMLLiteral datatype to inherit all xmlns and prefixes an properly merge with xmlns', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark -Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"' + - 'Mark\n' + - 'Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), - ]); - }); - - it('rdf:XMLLiteral datatype to preserve all nested tags and not ignore RDFa in children', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Mark' + - '"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/firstName', - '"Mark"'), - ]); - }); - - it('rdf:XMLLiteral datatype to preserve all nested tags and ignore RDFa in children ' + - 'if features.skipHandlingXmlLiteralChildren is enabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: { skipHandlingXmlLiteralChildren: true } }); - return expect(await parse(parser, ` - - Test 0006 - - -

Mark

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Mark' + - '"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), - ]); - }); - - it('rdf:HTML datatype to preserve all nested tags when features.htmlDatatype is enabled', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Mark ' + - '' + - 'Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML'), - ]); - }); - - it('rdf:HTML datatype to not preserve all nested tags when features.htmlDatatype is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - Test 0006 - - -

Mark Birbeck

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Mark Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML'), - ]); - }); - - it('lang to set the object literal language', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

abc

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"abc"@en'), - ]); - }); - - it('lang should be ignored when features.langAttribute is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {}}); - return expect(await parse(parser, ` - - Test 0006 - - -

abc

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"abc"'), - ]); - }); - - it('xml:lang to set the object literal language', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

abc

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"abc"@en'), - ]); - }); - - it('lang to set the object literal language for content attributes', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"abc"@en'), - ]); - }); - - it('xml:lang to set the object literal language for content attributes', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"abc"@en'), - ]); - }); - - it('xml:lang is inherited', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"abc"@en'), - ]); - }); - - it('xml:lang can be unset', async () => { - return expect(await parse(parser, ` - - Test 0006 - - -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"abc"'), - ]); - }); - - it('time tags with dates', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"2012-03-18"^^http://www.w3.org/2001/XMLSchema#date'), - ]); - }); - - it('time tags with dates when features.timeTag is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"2012-03-18"'), - ]); - }); - - it('time tags with times', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"00:00:00Z"^^http://www.w3.org/2001/XMLSchema#time'), - ]); - }); - - it('time tags with dateTimes', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"2012-03-18T00:00:00Z"^^http://www.w3.org/2001/XMLSchema#dateTime'), - ]); - }); - - it('time tags with dates in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"2012-03-18"^^http://www.w3.org/2001/XMLSchema#date'), - ]); - }); - - it('time tags with dates in datetime, with overridden datatype', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"2012-03-18"^^http://www.w3.org/2001/XMLSchema#thing'), - ]); - }); - - it('time tags with dates in datetime when features.datetimeAttribute is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Today"'), - ]); - }); - - it('time tags with times in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"00:00:00Z"^^http://www.w3.org/2001/XMLSchema#time'), - ]); - }); - - it('time tags with dateTimes in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"2012-03-18T00:00:00Z"^^http://www.w3.org/2001/XMLSchema#dateTime'), - ]); - }); - - it('time tags with full durations in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"P2Y6M5DT12H35M30S"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with day and hour durations in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"P1DT2H"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with month durations in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"P20M"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with minute durations in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"PT20M"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with durations with optional 0s in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"P0Y20M0D"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with 0 year durations in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"P0Y"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with minus 60 days durations in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"-P60D"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with decimal second durations in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"PT1M30.5S"^^http://www.w3.org/2001/XMLSchema#duration'), - ]); - }); - - it('time tags with invalid durations without T for time in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"P1M30.5S"'), - ]); - }); - - it('time tags with invalid durations with unknown character in datetime', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"P2X6M5DT12H35M30S"'), - ]); - }); - - it('vocab emits an rdfa:usesVocabulary triple', async () => { - return expect(await parse(parser, ` - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://xmlns.com/foaf/0.1/'), - ]); - }); - - it('vocab sets the active vocabulary', async () => { - return expect(await parse(parser, ` - - - -

Name

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://xmlns.com/foaf/0.1/'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Name"'), - ]); - }); - - it('vocab override the active vocabulary', async () => { - return expect(await parse(parser, ` - - - -

Name

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://example.org/'), - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://xmlns.com/foaf/0.1/'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Name"'), - ]); - }); - - it('with vocab set in parser constructor', async () => { - parser = new RdfaParser({ - baseIRI: 'http://example.org/', - vocab: 'http://xmlns.com/foaf/0.1/', - }); - return expect(await parse(parser, ` - - - -

Name

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Name"'), - ]); - }); - - it('with language set in parser constructor', async () => { - parser = new RdfaParser({ - baseIRI: 'http://example.org/', - language: 'nl-be', - }); - return expect(await parse(parser, ` - - - -

Name

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Name"@nl-be'), - ]); - }); - - it('multiple properties', async () => { - return expect(await parse(parser, ` - - - -

Title

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Title"'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/title', - '"Title"'), - ]); - }); - - it('multiple properties separated by newlines and spaces', async () => { - return expect(await parse(parser, ` - - - -

Title

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Title"'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/title', - '"Title"'), - ]); - }); - - it('chained rel and property', async () => { - return expect(await parse(parser, ` - - - -

- This paper was written by - - Ben Adida. - -

-`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/creator', - '_:b'), - quad('_:b', - 'http://xmlns.com/foaf/0.1/name', - '"Ben Adida"'), - ]); - }); - - it('chained rev and property', async () => { - return expect(await parse(parser, ` - - - -

- This paper was written by - - Ben Adida. - -

-`)) - .toBeRdfIsomorphic([ - quad('_:b', - 'http://purl.org/dc/elements/1.1/creator', - 'http://example.org/'), - quad('_:b', - 'http://xmlns.com/foaf/0.1/name', - '"Ben Adida"'), - ]); - }); - - it('multiple chained rel and property', async () => { - return expect(await parse(parser, ` - - - -

- This paper was written by - - Ben Adida. - -

-`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/creator', - '_:b'), - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/creator2', - '_:b'), - quad('_:b', - 'http://xmlns.com/foaf/0.1/name', - '"Ben Adida"'), - ]); - }); - - it('and ignore rel if there is a property and rel is a non-CURIE and non-URI', async () => { - return expect(await parse(parser, ` - - - -

- The homepage of Some Body. -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://example.org/', - 'http://schema.org/homepage', - 'http://homepage.org/'), - ]); - }); - - it('and not ignore rel if there is a property and rel is a non-CURIE and non-URI if ' + - 'features.onlyAllowUriRelRevIfProperty is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - - -

- The homepage of Some Body. -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://example.org/', - 'http://schema.org/homepage', - '"Some Body"'), - quad('http://example.org/', - 'http://schema.org/follow', - 'http://homepage.org/'), - ]); - }); - - it('and ignore rev if there is a property and rel is a non-CURIE and non-URI', async () => { - return expect(await parse(parser, ` - - - -

- The homepage of Some Body. -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://example.org/', - 'http://schema.org/homepage', - 'http://homepage.org/'), - ]); - }); - - it('and not ignore rel if there is a property and rel is a CURIE', async () => { - return expect(await parse(parser, ` - - - -

- The homepage of Some Body. -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://example.org/', - 'http://schema.org/follow', - 'http://homepage.org/'), - quad('http://example.org/', - 'http://schema.org/homepage', - '"Some Body"'), - ]); - }); - - it('and not ignore rel if there is a property and rel is a URI', async () => { - return expect(await parse(parser, ` - - - -

- The homepage of Some Body. -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://example.org/', - 'http://example.org/follow', - 'http://homepage.org/'), - quad('http://example.org/', - 'http://schema.org/homepage', - '"Some Body"'), - ]); - }); - - it('and not ignore rev if there is a property and rev is a CURIE', async () => { - return expect(await parse(parser, ` - - - -

- The homepage of Some Body -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://homepage.org/', - 'http://schema.org/followedBy', - 'http://example.org/'), - quad('http://example.org/', - 'http://schema.org/homepage', - '"Some Body"'), - ]); - }); - - it('and not ignore rev if there is a property and rev is a URI', async () => { - return expect(await parse(parser, ` - - - -

- The homepage of Some Body -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://homepage.org/', - 'http://example.org/followedBy', - 'http://example.org/'), - quad('http://example.org/', - 'http://schema.org/homepage', - '"Some Body"'), - ]); - }); - - it('unsetting vocab', async () => { - return expect(await parse(parser, ` - - - -

- The homepage of Some Body. -

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - ]); - }); - - it('rel with one typeof child should have their blank node be connected', async () => { - return expect(await parse(parser, ` - - - -
-

Dan Brickley again:-)

-
- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b1'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - ]); - }); - - it('complex blank node nesting', async () => { - return expect(await parse(parser, ` - - - -
-

Dan Brickley

-

Dan Brickley again:-)

-
-

Dan Brickley?

- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b1'), - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b2'), - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley"'), - quad('_:b2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley?"'), - ]); - }); - - it('complex explicit blank node nesting', async () => { - return expect(await parse(parser, ` - - - -
-

Dan Brickley

-

Dan Brickley again:-)

-
-

Dan Brickley?

- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b1'), - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley"'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley?"'), - ]); - }); - - it('complex partial explicit blank node nesting', async () => { - return expect(await parse(parser, ` - - - -
-

Dan Brickley

-

Dan Brickley again:-)

-
-

Dan Brickley?

- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b1'), - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b2'), - quad('_:b2', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley"'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley?"'), - ]); - }); - - it('complex disconnected explicit blank node nesting', async () => { - return expect(await parse(parser, ` - - - -
-

Dan Brickley

-

Dan Brickley again:-)

-
-

Dan Brickley?

- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b1'), - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b2'), - quad('_:b2', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley"'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - quad('_:b3', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley?"'), - ]); - }); - - it('complex connected explicit blank node nesting', async () => { - return expect(await parse(parser, ` - - - -
-

Dan Brickley

-

Dan Brickley again:-)

-
-

Dan Brickley?

- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b1'), - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley"'), - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley again:-)"'), - quad('_:b3', - 'http://xmlns.com/foaf/0.1/name', - '"Dan Brickley?"'), - ]); - }); - - it('blank node nesting with typeof', async () => { - return expect(await parse(parser, ` - - - -
-

Dan Brickley again:-)

-
- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/#somebody', - 'http://xmlns.com/foaf/0.1/knows', - '_:b1'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - ]); - }); - - it('rdfa:Pattern without rdfa:copy', async () => { - expect(await parse(parser, ` - - - -
-
- - - - Muse -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#muse', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://www.w3.org/ns/rdfa#Pattern'), - quad('http://example.org/#muse', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('http://example.org/#muse', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('http://example.org/#muse', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('http://example.org/#muse', - 'http://schema.org/name', - '"Muse"'), - ]); - - delete parser.rdfaPatterns['#muse'].text; - delete parser.rdfaPatterns['#muse'].parentTag; - expect(parser.rdfaPatterns).toEqual({ - '#muse': { - attributes: {}, - children: [ - { - attributes: { - href: 'Muse1.jpg', - property: 'schema:image', - }, - children: [], - name: 'link', - referenced: false, - rootPattern: false, - text: [], - }, - { - attributes: { - href: 'Muse2.jpg', - property: 'schema:image', - }, - children: [], - name: 'link', - referenced: false, - rootPattern: false, - text: [], - }, - { - attributes: { - href: 'Muse3.jpg', - property: 'schema:image', - }, - children: [], - name: 'link', - referenced: false, - rootPattern: false, - text: [], - }, - { - attributes: { - property: 'schema:name', - }, - children: [], - name: 'span', - referenced: false, - rootPattern: false, - text: [ 'Muse' ], - }, - ], - constructedBlankNodes: [], - name: 'div', - referenced: false, - rootPattern: true, - }, - }); - }); - - it('rdfa:Pattern on root without rdfa:copy', async () => { - expect(await parse(parser, ` - - - -
-
- - - - Muse -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#muse', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://www.w3.org/ns/rdfa#Pattern'), - quad('http://example.org/#muse', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('http://example.org/#muse', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('http://example.org/#muse', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('http://example.org/#muse', - 'http://schema.org/name', - '"Muse"'), - ]); - }); - - it('rdfa:Pattern with one rdfa:copy with href', async () => { - return expect(await parse(parser, ` - - - -
-
- - - - Muse -
- -

- - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('rdfa:Pattern with one rdfa:copy with resource', async () => { - return expect(await parse(parser, ` - - - -
-
- - - - Muse -
- -

- - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('rdfa:Pattern with one rdfa:copy with src', async () => { - return expect(await parse(parser, ` - - - -
-
- - - - Muse -
- -

- - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('unreferenced rdfa:copy', async () => { - return expect(await parse(parser, ` - - - -

- - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://www.w3.org/ns/rdfa#copy', - 'http://example.org/#muse'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('rdfa:Pattern with two rdfa:copy\'s', async () => { - return expect(await parse(parser, ` - - - -
-
- - - - Muse -
- -

- - United Center, Chicago, Illinois -

- -

- - United Center, Chicago, Illinois 2 -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - - quad('_:b2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b2', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b2', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b2', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b2', - 'http://schema.org/name', - '"Muse"'), - quad('_:b2', - 'http://schema.org/location', - 'http://example.org/#united2'), - ]); - }); - - it('rdfa:Pattern with blank node with two rdfa:copy\'s should only create a single blank node', async () => { - return expect(await parse(parser, ` - - - -
-
-
- Muse -
-
- -

- -

- -

- -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/refers-to', - '_:b_shared'), - quad('_:b_shared', - 'http://schema.org/name', - '"Muse"'), - - quad('_:b2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b2', - 'http://schema.org/refers-to', - '_:b_shared'), - ]); - }); - - it('rdfa:Pattern with two rdfa:copy\'s before the pattern definition', async () => { - return expect(await parse(parser, ` - - - -
-

- - United Center, Chicago, Illinois -

- -

- - United Center, Chicago, Illinois 2 -

- -
- - - - Muse -
- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - - quad('_:b2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b2', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b2', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b2', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b2', - 'http://schema.org/name', - '"Muse"'), - quad('_:b2', - 'http://schema.org/location', - 'http://example.org/#united2'), - ]); - }); - - it('rdfa:Pattern with two rdfa:copy\'s next to each other', async () => { - return expect(await parse(parser, ` - - - -
-
- - - - Muse -
- -

- - - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('out-of-order rdfa:Pattern with one rdfa:copy', async () => { - return expect(await parse(parser, ` - - - -
-

- - United Center, Chicago, Illinois -

- -
- - - - Muse -
- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('in-order nested rdfa:Pattern and rdfa:copy', async () => { - return expect(await parse(parser, ` - - - -
-
- Muse -
-
- - - - -
- -

- - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('mixed order nested rdfa:Pattern and rdfa:copy', async () => { - return expect(await parse(parser, ` - - - -
-
- - - - -
-
- Muse -
- -

- - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('and ignore rdfa:copy to self-referencing rdfa:Pattern', async () => { - return expect(await parse(parser, ` - - - -
-
- - - - Muse - -
- -

- - United Center, Chicago, Illinois -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/MusicEvent'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse1.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse2.jpg'), - quad('_:b1', - 'http://schema.org/image', - 'http://example.org/Muse3.jpg'), - quad('_:b1', - 'http://schema.org/name', - '"Muse"'), - quad('_:b1', - 'http://schema.org/location', - 'http://example.org/#united'), - ]); - }); - - it('rdfa:copy via resource attribute', async () => { - return expect(await parse(parser, ` - - - -
- -
-

Name: Amanda

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Person'), - quad('_:b1', - 'http://schema.org/name', - '"Amanda"'), - ]); - }); - - it('rdfa:copy and rdfa:Pattern are ignored when features.copyRdfaPatterns is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - - -
- -
-

Name: Amanda

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://schema.org/Person'), - quad('_:b1', - 'http://www.w3.org/ns/rdfa#copy', - '_:b2'), - quad('_:b2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://www.w3.org/ns/rdfa#Pattern'), - quad('_:b2', - 'http://schema.org/name', - '"Amanda"'), - ]); - }); - - it('typeof with a single property', async () => { - return expect(await parse(parser, ` - - Test 0051 - - -

John Doe

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/topic', - '"John Doe"'), - ]); - }); - - it('typeof with a single property and resource', async () => { - return expect(await parse(parser, ` - - Test 0051 - - -

John Doe

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/res', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/topic', - 'http://example.org/res'), - ]); - }); - - it('typeof with a single property and compact resource', async () => { - return expect(await parse(parser, ` - - Test 0051 - - -

John Doe

- -`)) - .toBeRdfIsomorphic([ - quad('http://xmlns.com/foaf/0.1/res', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/topic', - 'http://xmlns.com/foaf/0.1/res'), - ]); - }); - - it('typeof with a single property and href', async () => { - return expect(await parse(parser, ` - - Test 0051 - - -

John Doe

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/href', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/topic', - 'http://example.org/href'), - ]); - }); - - it('typeof with a single property and compact href', async () => { - return expect(await parse(parser, ` - - Test 0051 - - -

John Doe

- -`)) - .toBeRdfIsomorphic([ - quad('foaf:href', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/topic', - 'foaf:href'), - ]); - }); - - it('typeof with a single property and src', async () => { - return expect(await parse(parser, ` - - Test 0051 - - -

John Doe

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/src', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/topic', - 'http://example.org/src'), - ]); - }); - - it('typeof with a single property and compact src', async () => { - return expect(await parse(parser, ` - - Test 0051 - - -

John Doe

- -`)) - .toBeRdfIsomorphic([ - quad('foaf:src', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/topic', - 'foaf:src'), - ]); - }); - - it('typeof on root tag without property and about', async () => { - return expect(await parse(parser, ` - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - ]); - }); - - it('typeof on root tag with property and without about', async () => { - return expect(await parse(parser, ` - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - 'http://example.org/'), - ]); - }); - - it('properties with inlist', async () => { - return expect(await parse(parser, ` - - - -

- Ben Adida, - Mark Birbeck, and - Ivan Herman. -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://ben.adida.net/#me'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l2'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://twitter.com/markbirbeck'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l3'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://www.ivan-herman.net/foaf#me'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('properties with inlist and tag literals', async () => { - return expect(await parse(parser, ` - - - -

- Ben Adida, - Mark Birbeck, and - Ivan Herman. -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://ben.adida.net/#me'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l2'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Mark Birbeck"'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l3'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://www.ivan-herman.net/foaf#me'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('properties with inlist and content literals', async () => { - return expect(await parse(parser, ` - - - -

- Ben Adida, - BlaBla, and - Ivan Herman. -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://ben.adida.net/#me'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l2'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Mark Birbeck"'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l3'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://www.ivan-herman.net/foaf#me'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('properties with inlist and datetime literals', async () => { - return expect(await parse(parser, ` - - - -

- Ben Adida, - , and - Ivan Herman. -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://ben.adida.net/#me'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l2'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"2018"^^http://www.w3.org/2001/XMLSchema#gYear'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l3'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://www.ivan-herman.net/foaf#me'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('properties and rel with inlist and mixed values', async () => { - return expect(await parse(parser, ` - - - -

- Ben Adida, - Mark Birbeck, and - Ivan Herman. -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://ben.adida.net/#me'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l2'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Mark Birbeck"'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l3'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://www.ivan-herman.net/foaf#me'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('inlist with incomplete triples', async () => { - return expect(await parse(parser, ` - - - -

- - Ben Adida, - Mark Birbeck, and - Ivan Herman. - -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://ben.adida.net/#me'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l2'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://twitter.com/markbirbeck'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l3'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://www.ivan-herman.net/foaf#me'), - quad('_:b_l3', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('an empty list', async () => { - return expect(await parse(parser, ` - - - -

- -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('a manual empty list', async () => { - return expect(await parse(parser, ` - - - -

- -

- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://purl.org/ontology/bibo/Chapter'), - quad('_:b1', - 'http://purl.org/dc/terms/creator', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('@rel and @inlist with decendent IRI elements creates list', async () => { - return expect(await parse(parser, ` - - - -
-
    -
  1. Foo
  2. -
  3. Bar
  4. -
-
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://example.org/foo'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - '_:b_l2'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - 'http://example.org/bar'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('@about and @inlist creates a separate list', async () => { - return expect(await parse(parser, ` - - - -

Bar

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/res', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Bar"'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('@about and @inlist create a separate lists', async () => { - return expect(await parse(parser, ` - - - -

Bar

-

Foo

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/res', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '_:b_l1'), - quad('http://example.org/res', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '_:b_l2'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Bar"'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Foo"'), - quad('_:b_l2', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('@property and @resource with child @inlist', async () => { - return expect(await parse(parser, ` - - Test 0226 - - - -

Bar

-
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.example.org/inlist', - 'http://example.org/res'), - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Bar"'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('@rel and @resource with child @inlist', async () => { - return expect(await parse(parser, ` - - Test 0226 - - - -

Bar

-
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.example.org/inlist', - 'http://example.org/res'), - quad('http://example.org/res', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '_:b_l1'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', - '"Bar"'), - quad('_:b_l1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), - ]); - }); - - it('xmlns definition', async () => { - return expect(await parse(parser, ` - - - - -

This is the first chapter in a series of chapters.

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://example.org/next', - 'http://rdfa.info/test-suite/test-cases/rdfa1.1/xhtml1/0062.xhtml'), - ]); - }); - - it('xmlns definition when features.xmlnsPrefixMappings is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - - - -

This is the first chapter in a series of chapters.

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'ex:next', - 'http://rdfa.info/test-suite/test-cases/rdfa1.1/xhtml1/0062.xhtml'), - ]); - }); - - it('@about that resolves to nothing', async () => { - return expect(await parse(parser, ` - - - -
Alex Milowski
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - ]); - }); - - it('@about that resolves to nothing with @typeof', async () => { - return expect(await parse(parser, ` - - - -
Alex Milowski
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - quad('_:b', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - ]); - }); - - it('@about that resolves to nothing in object', async () => { - return expect(await parse(parser, ` - - Test 0298: Testing @typeof and @about=[] - - -
- Alex Milowski -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - ]); - }); - - it('@about that resolves to nothing with child rel', async () => { - return expect(await parse(parser, ` - - - -

Alex Milowski

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - ]); - }); - - it('@about that resolves to nothing with child tag', async () => { - return expect(await parse(parser, ` - - - -

Alex Milowski

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - ]); - }); - - it('@about that resolves to nothing with child tag with property', async () => { - return expect(await parse(parser, ` - - - -

Alex

Milowski
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/firstName', - '"Alex"'), - ]); - }); - - it('no @about with @typeof', async () => { - return expect(await parse(parser, ` - - Test 0298: Testing @typeof and @about=[] - - -
- Alex Milowski -
- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - ]); - }); - - it('@about that resolves to nothing in object with @typeof', async () => { - return expect(await parse(parser, ` - - Test 0298: Testing @typeof and @about=[] - - -
- Alex Milowski -
- -`)) - .toBeRdfIsomorphic([ - quad('_:b1', - 'http://xmlns.com/foaf/0.1/name', - '"Alex Milowski"'), - quad('_:b1', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - ]); - }); - - it('standalone @href', async () => { - return expect(await parse(parser, ` - - - - Alex Milowski - -`)) - .toBeRdfIsomorphic([]); - }); - - it('standalone @src', async () => { - return expect(await parse(parser, ` - - - - - -`)) - .toBeRdfIsomorphic([]); - }); - - it('@resource with nested [] property', async () => { - return expect(await parse(parser, ` - - - -
-

-

- Shane McCarron - contributed to this test. -

-

-
- `)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/contributor', - '"Shane McCarron"'), - ]); - }); - - it('@about and @resource with []', async () => { - return expect(await parse(parser, ` - - - -
-

- Test Case 0121 - checks to make sure RDFa processors resolve the empty CURIE correctly. -

- Shane McCarron - contributed to this test. -

-

-
- `)) - .toBeRdfIsomorphic([ - quad('https://mydomain.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Test Case 0121"'), - quad('http://example.org/', - 'http://purl.org/dc/elements/1.1/contributor', - '"Shane McCarron"'), - ]); - }); - - it('@resource with nested [] property in XML mode', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', profile: 'xml' }); - return expect(await parse(parser, ` - - - -
-

-

- Shane McCarron - contributed to this test. -

-

-
- `)) - .toBeRdfIsomorphic([ - quad('https://mydomain.org/', - 'http://purl.org/dc/elements/1.1/contributor', - '"Shane McCarron"'), - ]); - }); - - it('@about and @resource with [] in XML mode', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', profile: 'xml' }); - return expect(await parse(parser, ` - - - -
-

- Test Case 0121 - checks to make sure RDFa processors resolve the empty CURIE correctly. -

- Shane McCarron - contributed to this test. -

-

-
- `)) - .toBeRdfIsomorphic([ - quad('https://mydomain.org/', - 'http://purl.org/dc/elements/1.1/title', - '"Test Case 0121"'), - quad('https://mydomain.org/', - 'http://purl.org/dc/elements/1.1/contributor', - '"Shane McCarron"'), - ]); - }); - - it('@resource with [] is not allowed and resolved to nothing', async () => { - return expect(await parse(parser, ` - - - - -

- This section is contained below the main site. -

- -`)) - .toBeRdfIsomorphic([]); - }); - - it('@typeof in , and inherit parent object', async () => { - return expect(await parse(parser, ` - - Test 0066 - - -

This is test #66.

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - ]); - }); - - it('@typeof in , and inherit parent object', async () => { - return expect(await parse(parser, ` - - Test 0066 - - -

This is test #66.

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - ]); - }); - - it('@typeof and @property in , and inherit parent object', async () => { - return expect(await parse(parser, ` - - Test 0066 - - -

This is test #66.

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - 'http://example.org/'), - ]); - }); - - it('@typeof and @property in , and not inherit parent object ' + - 'if features.inheritSubjectInHeadBody is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - Test 0066 - - -

This is test #66.

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '_:b'), - quad('_:b', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - ]); - }); - - it('@typeof and @rel in ', async () => { - return expect(await parse(parser, ` - - Test 0066 - - -

This is test #66.

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - ]); - }); - - it('@typeof and @rel in when features.inheritSubjectInHeadBody is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - Test 0066 - - -

This is test #66.

- -`)) - .toBeRdfIsomorphic([ - quad('_:b', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Document'), - quad('http://example.org/', - 'http://xmlns.com/foaf/0.1/name', - '_:b'), - ]); - }); - - it('should ignore invalid datatypes', async () => { - return expect(await parse(parser, ` - - - - -

JavaScript

- -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/me', - 'http://purl.org/dc/terms/language', - '"JavaScript"'), - ]); - }); - - it('@property with no children should make empty literal', async () => { - return expect(await parse(parser, ` - - Test 0257 - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#a', - 'http://purl.org/dc/elements/1.1/title', - '""'), - ]); - }); - - it('@about and empty @datatype should force string literal value', async () => { - return expect(await parse(parser, ` - - Test 0290 - - -

@href becomes subject when @property and @datatype are present

-

value

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '"value"'), - ]); - }); - - it('@about and empty @datatype should force string literal value even with xmlns', async () => { - return expect(await parse(parser, ` - - Test 0290 - - -

@href becomes subject when @property and @datatype are present

-

value

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '"value"'), - ]); - }); - - it('@href and empty @datatype should force string literal value', async () => { - return expect(await parse(parser, ` - - Test 0290 - - -

@href becomes subject when @property and @datatype are present

- value - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', - '"value"'), - ]); - }); - - it('@property does not set parent object without @typeof', async () => { - return expect(await parse(parser, ` - - Test 0296 - - -
- Gregg -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://xmlns.com/foaf/0.1/'), - quad('http://example.com/gregg/#me', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - quad('http://example.com/gregg/#me', - 'http://xmlns.com/foaf/0.1/homepage', - 'http://example.com/gregg/'), - quad('http://example.com/gregg/#me', - 'http://xmlns.com/foaf/0.1/name', - '"Gregg"'), - ]); - }); - - it('@property does set parent object with @typeof', async () => { - return expect(await parse(parser, ` - - Test 0296 - - -
- Gregg -
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://xmlns.com/foaf/0.1/'), - quad('http://example.com/gregg/', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://xmlns.com/foaf/0.1/Person'), - quad('http://example.com/gregg/#me', - 'http://xmlns.com/foaf/0.1/homepage', - 'http://example.com/gregg/'), - quad('http://example.com/gregg/', - 'http://xmlns.com/foaf/0.1/name', - '"Gregg"'), - ]); - }); - - it('@resource that resolves to nothing should fallback to @href or @src', async () => { - return expect(await parse(parser, ` - - Test 0300: Testing @resource=[] - - - The Foo Document - -`)) - .toBeRdfIsomorphic([ - quad('http://www.example.org/', - 'http://www.w3.org/1999/xhtml/vocab#license', - 'http://www.example.org/license.xhtml'), - ]); - }); - - it('@rel should not do vocab expansion when another valid value is present', async () => { - return expect(await parse(parser, ` - - Test 0334: @resource changes the current subject for the nested elements - - -
-
-

Gregg Kellogg

-
-
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/ns/rdfa#usesVocabulary', - 'http://schema.org/'), - quad('http://greggkellogg.net/#me', - 'http://schema.org/name', - '"Gregg Kellogg"'), - quad('http://greggkellogg.net/#me', - 'http://xmlns.com/foaf/0.1/homepage', - 'http://greggkellogg.net/'), - ]); - }); - - it('xml:base to set the baseIRI within the current scope', async () => { - return expect(await parse(parser, ` - - version="1.2" - baseProfile="tiny" - A yellow rectangle with sharp corners. - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.com/', - 'http://purl.org/dc/terms/description', - '"A yellow rectangle with sharp corners."'), - ]); - }); - - it('xml:base shoud not set the baseIRI outside the current scope', async () => { - return expect(await parse(parser, ` - - version="1.2" - baseProfile="tiny" -

abc

- A yellow rectangle with sharp corners. - - - -
`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/terms/description', - '"A yellow rectangle with sharp corners."'), - ]); - }); - - it('xml:base not to set the baseIRI when features.xmlBase is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - version="1.2" - baseProfile="tiny" - A yellow rectangle with sharp corners. - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://purl.org/dc/terms/description', - '"A yellow rectangle with sharp corners."'), - ]); - }); - - it('should be able to ignore base tag and resolve relative IRIs against baseIRI', async () => { - const features = { baseTag: false, xmlBase: true, xmlnsPrefixMappings: true }; - parser = new RdfaParser({ baseIRI: 'http://example.org/', features }); - return expect(await parse(parser, ` - - - - Test 0319 - - -

value

- -
`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://example.org/relative/iri#prop', - '"value"'), - quad('http://example.org/', - 'http://example.org/relative/uri#prop', - '"value"'), - ]); - }); - - it('should be able to ignore base tag and resolve relative IRIs against baseIRI in HTML-mode', async () => { - return expect(await parse(parser, ` - - - - Test 0319 - - -

value

- -`)) - .toBeRdfIsomorphic([ - quad('http://example.com/', - 'http://example.org/relative/iri#prop', - '"value"'), - quad('http://example.com/', - 'http://example.org/relative/uri#prop', - '"value"'), - ]); - }); - - it('should handle whitespace alternatives', async () => { - return expect(await parse(parser, ` - - Test - - - - -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#first', - 'http://example.org/test.css'), - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#last', - 'http://example.org/test.css'), - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#next', - 'http://example.org/test.css'), - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#prev', - 'http://example.org/test.css'), - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#subsection', - 'http://example.org/test.css'), - ]); - }); - - it('should handle terms from the XHTML initial context', async () => { - return expect(await parse(parser, ` - - Test 0259 - - -
- Vocabulary Terms - alternate - appendix - cite -
-`)) - .toBeRdfIsomorphic([ - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#alternate', - '"alternate"'), - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#appendix', - '"appendix"'), - quad('http://example.org/', - 'http://www.w3.org/1999/xhtml/vocab#cite', - '"cite"'), - ]); - }); - - it('should handle terms from the XHTML initial context ' + - 'unless features.xhtmlInitialContext is disabled', async () => { - parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); - return expect(await parse(parser, ` - - Test 0259 - - -
- Vocabulary Terms - alternate - appendix - cite -
-`)) - .toBeRdfIsomorphic([]); - }); - - it('property with blank node values should be ignored', async () => { - return expect(await parse(parser, ` +// it('an empty document', async () => { +// return expect(await parse(parser, ``)) +// .toBeRdfIsomorphic([]); +// }); + +// it('property attributes to predicates', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), +// ]); +// }); + +// it('multi-line strings', async () => { +// return expect(await parse(parser, ` +// +// +//

The +// Trouble +// with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://purl.org/dc/terms/title', '"The\nTrouble\nwith Bob"'), +// ]); +// }); + +// it('absolute about attributes to subjects', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example2.org/', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), +// ]); +// }); + +// it('relative about attributes to subjects', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/img.jpg', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), +// ]); +// }); + +// it('blank node about attributes to subjects', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', 'http://purl.org/dc/terms/title', '"The Trouble with Bob"'), +// ]); +// }); + +// it('content attributes to objects', async () => { +// return expect(await parse(parser, ` +// +// +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://purl.org/dc/terms/title', 'http://example.org/img.jpg'), +// ]); +// }); + +// it('prefixes and expand them', async () => { +// return expect(await parse(parser, ` +// +// +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://purl.org/dc/terms/title', 'http://example.org/img.jpg'), +// ]); +// }); + +// it('property with default prefix and expand them', async () => { +// return expect(await parse(parser, ` +// +// +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://www.w3.org/1999/xhtml/vocab#title', 'http://example.org/img.jpg'), +// ]); +// }); + +// it('base tags and set the baseIRI', async () => { +// const output = await parse(parser, ` +// +// +// +// +//
+// +// `); +// expect(output).toBeRdfIsomorphic([ +// quad('http://base.com/', 'http://purl.org/dc/terms/title', 'http://base.com/img.jpg'), +// ]); +// return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://base.com/')); +// }); + +// it('base tags are ignored when features.baseTag is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// const output = await parse(parser, ` +// +// +// +// +//
+// +// `); +// expect(output).toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://purl.org/dc/terms/title', 'http://example.org/img.jpg'), +// ]); +// return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://example.org/')); +// }); + +// it('base tags with fragment and set the baseIRI', async () => { +// const output = await parse(parser, ` +// +// +// +// +//
+// +// `); +// expect(output).toBeRdfIsomorphic([ +// quad('http://base.com/', 'http://purl.org/dc/terms/title', 'http://base.com/img.jpg'), +// ]); +// return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://base.com/')); +// }); + +// it('base tags without href and not set the baseIRI', async () => { +// await parse(parser, ` +// +// +// +// +//
+// +// `); +// return expect(parser.util.baseIRI).toEqualRdfTerm(DF.namedNode('http://example.org/')); +// }); + +// it('typeof with about', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Document'), +// ]); +// }); + +// it('empty typeof with defined vocab', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// ]); +// }); + +// it('typeofs with about', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Document1'), +// quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Document2'), +// ]); +// }); + +// it('typeof with resource', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#myDoc', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Document'), +// ]); +// }); + +// it('typeof with about and resource', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#myDoc1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Document'), +// ]); +// }); + +// it('typeof without about and resource', async () => { +// return expect(await parse(parser, ` +// +// +//

The Trouble with Bob

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Document'), +// ]); +// }); + +// it('typeof without about and resource and children', async () => { +// return expect(await parse(parser, ` +// +// +//
+// Albert Einstein +// Albert +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://schema.org/Person'), +// quad('_:b1', 'http://schema.org/name', '"Albert Einstein"'), +// quad('_:b1', 'http://schema.org/givenName', '"Albert"'), +// ]); +// }); + +// it('rel and href as resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), +// ]); +// }); + +// it('rel on root tag', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), +// ]); +// }); + +// it('rel and href as resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/s', 'http://example.org/p', 'http://example.org/o'), +// quad('http://example.org/s', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://example.org/Type'), +// ]); +// }); + +// it('rel and resource as resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), +// ]); +// }); + +// it('rel (2x) and resource as resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://example.org/p1', 'http://example.org/o'), +// quad('http://example.org/', 'http://example.org/p2', 'http://example.org/o'), +// ]); +// }); + +// it('rel and src as resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://example.org/p', 'http://example.org/o'), +// ]); +// }); + +// it('rev and href as reverse resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/o', 'http://example.org/p', 'http://example.org/'), +// ]); +// }); + +// it('rev and resource as reverse resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/o', 'http://example.org/p', 'http://example.org/'), +// ]); +// }); + +// it('rev and src as reverse resource link', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/o', 'http://example.org/p', 'http://example.org/'), +// ]); +// }); + +// it('rel, rev and src as reverse resource links', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://example.org/p1', 'http://example.org/o'), +// quad('http://example.org/o', 'http://example.org/p2', 'http://example.org/'), +// ]); +// }); + +// it('resource should be prioritized over href', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', 'http://example.org/p', 'http://example.org/o1'), +// ]); +// }); + +// it('complex combinations of about, rel, rev and href', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

+// This photo was taken by +// Mark Birbeck. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/photo1.jpg', +// 'http://purl.org/dc/elements/1.1/creator', +// 'http://www.blogger.com/profile/1109404'), +// quad('http://www.blogger.com/profile/1109404', +// 'http://xmlns.com/foaf/0.1/img', +// 'http://example.org/photo1.jpg'), +// ]); +// }); + +// it('content attributes', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/photo1.jpg', +// 'http://purl.org/dc/elements/1.1/title', +// '"Portrait of Mark"'), +// ]); +// }); + + it('content attributes prefixes', async () => { + return expect(await collectPrefixes(parser, ` + Test 0006 -

Value ignored

+

`)) - .toBeRdfIsomorphic([]); - }); - - it('role attribute with id', async () => { - return expect(await parse(parser, ` - - Test 0305 - - -

-

Some contents that are a header

-
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#heading1', - 'http://www.w3.org/1999/xhtml/vocab#role', - 'http://www.w3.org/1999/xhtml/vocab#heading'), - ]); - }); - - it('role attribute without id', async () => { - return expect(await parse(parser, ` - - Test 0305 - - -
-

Some contents that are a header

-
- -`)) - .toBeRdfIsomorphic([ - quad('_:b', - 'http://www.w3.org/1999/xhtml/vocab#role', - 'http://www.w3.org/1999/xhtml/vocab#heading'), - ]); - }); - - it('role attribute with multiple values', async () => { - return expect(await parse(parser, ` - - Test 0305 - - -
-

Some contents that are a header

-
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#heading1', - 'http://www.w3.org/1999/xhtml/vocab#role', - 'http://www.w3.org/1999/xhtml/vocab#heading1'), - quad('http://example.org/#heading1', - 'http://www.w3.org/1999/xhtml/vocab#role', - 'http://www.w3.org/1999/xhtml/vocab#heading2'), - ]); - }); - - it('role attribute with absolute IRI', async () => { - return expect(await parse(parser, ` - - Test 0305 - - -
-

Some contents that are a header

-
- -`)) - .toBeRdfIsomorphic([ - quad('http://example.org/#heading1', - 'http://www.w3.org/1999/xhtml/vocab#role', - 'http://ex.org/heading'), - ]); - }); + .toEqual({ + dc: DF.namedNode('http://purl.org/dc/elements/1.1/'), + }); + }); + +// it('content that overrides text content', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/photo1.jpg', +// 'http://purl.org/dc/elements/1.1/title', +// '"Portrait of Mark"'), +// ]); +// }); + +// it('nested text content', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+// John +// Doe +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/foaf#me', +// 'http://xmlns.com/foaf/0.1/familyName', +// '"Doe"'), +// quad('http://example.org/foaf#me', +// 'http://xmlns.com/foaf/0.1/givenName', +// '"John"'), +// quad('http://example.org/foaf#me', +// 'http://xmlns.com/foaf/0.1/name', +// '"\n John\n Doe\n "'), +// ]); +// }); + +// it('inline nested text content', async () => { +// // tslint:disable:max-line-length +// return expect(await parse(parser, ` +// +// +// +//
John Doe
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/foaf#me', +// 'http://xmlns.com/foaf/0.1/familyName', +// '"Doe"'), +// quad('http://example.org/foaf#me', +// 'http://xmlns.com/foaf/0.1/givenName', +// '"John"'), +// quad('http://example.org/foaf#me', +// 'http://xmlns.com/foaf/0.1/name', +// '"John Doe"'), +// ]); +// // tslint:enable:max-line-length +// }); + +// it('datatype to set the object literal datatype', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

3

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"3"^^http://www.w3.org/2001/XMLSchema#integer'), +// ]); +// }); + +// it('datatype to set the object literal datatype for content attributes', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"3"^^http://www.w3.org/2001/XMLSchema#integer'), +// ]); +// }); + +// it('datatype to set the object literal datatype with strings in a nested tag', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Mark Birbeck"'), +// ]); +// }); + +// it('datatype to set the object literal datatype with strings in nested tags', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Mark Birbeck"'), +// ]); +// }); + +// it('rdf:XMLLiteral datatype to preserve all nested tags', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Mark' + +// ' ' + +// 'Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), +// ]); +// }); + +// it('rdf:XMLLiteral datatype to preserve all nested tags without xmlns and prefixes', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/terms/title', +// '"Mark Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), +// ]); +// }); + +// it('rdf:XMLLiteral datatype to inherit all xmlns and prefixes', async () => { +// const attrs = 'xmlns="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" ' + +// 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"'; +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// `"Mark Birbeck"` +// + '^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), +// ]); +// }); + +// it('rdf:XMLLiteral datatype to inherit all xmlns and prefixes an properly merge with xmlns', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark +// Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"' + +// 'Mark\n' + +// 'Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), +// ]); +// }); + +// it('rdf:XMLLiteral datatype to preserve all nested tags and not ignore RDFa in children', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Mark' + +// '"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/firstName', +// '"Mark"'), +// ]); +// }); + +// it('rdf:XMLLiteral datatype to preserve all nested tags and ignore RDFa in children ' + +// 'if features.skipHandlingXmlLiteralChildren is enabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: { skipHandlingXmlLiteralChildren: true } }); +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Mark' + +// '"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'), +// ]); +// }); + +// it('rdf:HTML datatype to preserve all nested tags when features.htmlDatatype is enabled', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Mark ' + +// '' + +// 'Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML'), +// ]); +// }); + +// it('rdf:HTML datatype to not preserve all nested tags when features.htmlDatatype is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

Mark Birbeck

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Mark Birbeck"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML'), +// ]); +// }); + +// it('lang to set the object literal language', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

abc

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"abc"@en'), +// ]); +// }); + +// it('lang should be ignored when features.langAttribute is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {}}); +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

abc

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"abc"'), +// ]); +// }); + +// it('xml:lang to set the object literal language', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

abc

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"abc"@en'), +// ]); +// }); + +// it('lang to set the object literal language for content attributes', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"abc"@en'), +// ]); +// }); + +// it('xml:lang to set the object literal language for content attributes', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"abc"@en'), +// ]); +// }); + +// it('xml:lang is inherited', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"abc"@en'), +// ]); +// }); + +// it('xml:lang can be unset', async () => { +// return expect(await parse(parser, ` +// +// Test 0006 +// +// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"abc"'), +// ]); +// }); + +// it('time tags with dates', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"2012-03-18"^^http://www.w3.org/2001/XMLSchema#date'), +// ]); +// }); + +// it('time tags with dates when features.timeTag is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"2012-03-18"'), +// ]); +// }); + +// it('time tags with times', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"00:00:00Z"^^http://www.w3.org/2001/XMLSchema#time'), +// ]); +// }); + +// it('time tags with dateTimes', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"2012-03-18T00:00:00Z"^^http://www.w3.org/2001/XMLSchema#dateTime'), +// ]); +// }); + +// it('time tags with dates in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"2012-03-18"^^http://www.w3.org/2001/XMLSchema#date'), +// ]); +// }); + +// it('time tags with dates in datetime, with overridden datatype', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"2012-03-18"^^http://www.w3.org/2001/XMLSchema#thing'), +// ]); +// }); + +// it('time tags with dates in datetime when features.datetimeAttribute is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Today"'), +// ]); +// }); + +// it('time tags with times in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"00:00:00Z"^^http://www.w3.org/2001/XMLSchema#time'), +// ]); +// }); + +// it('time tags with dateTimes in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"2012-03-18T00:00:00Z"^^http://www.w3.org/2001/XMLSchema#dateTime'), +// ]); +// }); + +// it('time tags with full durations in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"P2Y6M5DT12H35M30S"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with day and hour durations in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"P1DT2H"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with month durations in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"P20M"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with minute durations in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"PT20M"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with durations with optional 0s in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"P0Y20M0D"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with 0 year durations in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"P0Y"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with minus 60 days durations in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"-P60D"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with decimal second durations in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"PT1M30.5S"^^http://www.w3.org/2001/XMLSchema#duration'), +// ]); +// }); + +// it('time tags with invalid durations without T for time in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"P1M30.5S"'), +// ]); +// }); + +// it('time tags with invalid durations with unknown character in datetime', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"P2X6M5DT12H35M30S"'), +// ]); +// }); + +// it('vocab emits an rdfa:usesVocabulary triple', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://xmlns.com/foaf/0.1/'), +// ]); +// }); + +// it('vocab sets the active vocabulary', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Name

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://xmlns.com/foaf/0.1/'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Name"'), +// ]); +// }); + +// it('vocab override the active vocabulary', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Name

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://example.org/'), +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://xmlns.com/foaf/0.1/'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Name"'), +// ]); +// }); + +// it('with vocab set in parser constructor', async () => { +// parser = new RdfaParser({ +// baseIRI: 'http://example.org/', +// vocab: 'http://xmlns.com/foaf/0.1/', +// }); +// return expect(await parse(parser, ` +// +// +// +//

Name

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Name"'), +// ]); +// }); + +// it('with language set in parser constructor', async () => { +// parser = new RdfaParser({ +// baseIRI: 'http://example.org/', +// language: 'nl-be', +// }); +// return expect(await parse(parser, ` +// +// +// +//

Name

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Name"@nl-be'), +// ]); +// }); + +// it('multiple properties', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Title

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Title"'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/title', +// '"Title"'), +// ]); +// }); + +// it('multiple properties separated by newlines and spaces', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Title

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Title"'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/title', +// '"Title"'), +// ]); +// }); + +// it('chained rel and property', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// This paper was written by +// +// Ben Adida. +// +//

+// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/creator', +// '_:b'), +// quad('_:b', +// 'http://xmlns.com/foaf/0.1/name', +// '"Ben Adida"'), +// ]); +// }); + +// it('chained rev and property', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// This paper was written by +// +// Ben Adida. +// +//

+// `)) +// .toBeRdfIsomorphic([ +// quad('_:b', +// 'http://purl.org/dc/elements/1.1/creator', +// 'http://example.org/'), +// quad('_:b', +// 'http://xmlns.com/foaf/0.1/name', +// '"Ben Adida"'), +// ]); +// }); + +// it('multiple chained rel and property', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// This paper was written by +// +// Ben Adida. +// +//

+// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/creator', +// '_:b'), +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/creator2', +// '_:b'), +// quad('_:b', +// 'http://xmlns.com/foaf/0.1/name', +// '"Ben Adida"'), +// ]); +// }); + +// it('and ignore rel if there is a property and rel is a non-CURIE and non-URI', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://example.org/', +// 'http://schema.org/homepage', +// 'http://homepage.org/'), +// ]); +// }); + +// it('and not ignore rel if there is a property and rel is a non-CURIE and non-URI if ' + +// 'features.onlyAllowUriRelRevIfProperty is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://example.org/', +// 'http://schema.org/homepage', +// '"Some Body"'), +// quad('http://example.org/', +// 'http://schema.org/follow', +// 'http://homepage.org/'), +// ]); +// }); + +// it('and ignore rev if there is a property and rel is a non-CURIE and non-URI', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://example.org/', +// 'http://schema.org/homepage', +// 'http://homepage.org/'), +// ]); +// }); + +// it('and not ignore rel if there is a property and rel is a CURIE', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://example.org/', +// 'http://schema.org/follow', +// 'http://homepage.org/'), +// quad('http://example.org/', +// 'http://schema.org/homepage', +// '"Some Body"'), +// ]); +// }); + +// it('and not ignore rel if there is a property and rel is a URI', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://example.org/', +// 'http://example.org/follow', +// 'http://homepage.org/'), +// quad('http://example.org/', +// 'http://schema.org/homepage', +// '"Some Body"'), +// ]); +// }); + +// it('and not ignore rev if there is a property and rev is a CURIE', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://homepage.org/', +// 'http://schema.org/followedBy', +// 'http://example.org/'), +// quad('http://example.org/', +// 'http://schema.org/homepage', +// '"Some Body"'), +// ]); +// }); + +// it('and not ignore rev if there is a property and rev is a URI', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://homepage.org/', +// 'http://example.org/followedBy', +// 'http://example.org/'), +// quad('http://example.org/', +// 'http://schema.org/homepage', +// '"Some Body"'), +// ]); +// }); + +// it('unsetting vocab', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// The homepage of Some Body. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// ]); +// }); + +// it('rel with one typeof child should have their blank node be connected', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

Dan Brickley again:-)

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b1'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// ]); +// }); + +// it('complex blank node nesting', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

Dan Brickley

+//

Dan Brickley again:-)

+//
+//

Dan Brickley?

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b1'), +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b2'), +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley"'), +// quad('_:b2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley?"'), +// ]); +// }); + +// it('complex explicit blank node nesting', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

Dan Brickley

+//

Dan Brickley again:-)

+//
+//

Dan Brickley?

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b1'), +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley"'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley?"'), +// ]); +// }); + +// it('complex partial explicit blank node nesting', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

Dan Brickley

+//

Dan Brickley again:-)

+//
+//

Dan Brickley?

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b1'), +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b2'), +// quad('_:b2', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley"'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley?"'), +// ]); +// }); + +// it('complex disconnected explicit blank node nesting', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

Dan Brickley

+//

Dan Brickley again:-)

+//
+//

Dan Brickley?

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b1'), +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b2'), +// quad('_:b2', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley"'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// quad('_:b3', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley?"'), +// ]); +// }); + +// it('complex connected explicit blank node nesting', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

Dan Brickley

+//

Dan Brickley again:-)

+//
+//

Dan Brickley?

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b1'), +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley"'), +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley again:-)"'), +// quad('_:b3', +// 'http://xmlns.com/foaf/0.1/name', +// '"Dan Brickley?"'), +// ]); +// }); + +// it('blank node nesting with typeof', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

Dan Brickley again:-)

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/#somebody', +// 'http://xmlns.com/foaf/0.1/knows', +// '_:b1'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// ]); +// }); + +// it('rdfa:Pattern without rdfa:copy', async () => { +// expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#muse', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://www.w3.org/ns/rdfa#Pattern'), +// quad('http://example.org/#muse', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('http://example.org/#muse', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('http://example.org/#muse', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('http://example.org/#muse', +// 'http://schema.org/name', +// '"Muse"'), +// ]); + +// delete parser.rdfaPatterns['#muse'].text; +// delete parser.rdfaPatterns['#muse'].parentTag; +// expect(parser.rdfaPatterns).toEqual({ +// '#muse': { +// attributes: {}, +// children: [ +// { +// attributes: { +// href: 'Muse1.jpg', +// property: 'schema:image', +// }, +// children: [], +// name: 'link', +// referenced: false, +// rootPattern: false, +// text: [], +// }, +// { +// attributes: { +// href: 'Muse2.jpg', +// property: 'schema:image', +// }, +// children: [], +// name: 'link', +// referenced: false, +// rootPattern: false, +// text: [], +// }, +// { +// attributes: { +// href: 'Muse3.jpg', +// property: 'schema:image', +// }, +// children: [], +// name: 'link', +// referenced: false, +// rootPattern: false, +// text: [], +// }, +// { +// attributes: { +// property: 'schema:name', +// }, +// children: [], +// name: 'span', +// referenced: false, +// rootPattern: false, +// text: [ 'Muse' ], +// }, +// ], +// constructedBlankNodes: [], +// name: 'div', +// referenced: false, +// rootPattern: true, +// }, +// }); +// }); + +// it('rdfa:Pattern on root without rdfa:copy', async () => { +// expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#muse', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://www.w3.org/ns/rdfa#Pattern'), +// quad('http://example.org/#muse', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('http://example.org/#muse', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('http://example.org/#muse', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('http://example.org/#muse', +// 'http://schema.org/name', +// '"Muse"'), +// ]); +// }); + +// it('rdfa:Pattern with one rdfa:copy with href', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +//
+ +//

+// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('rdfa:Pattern with one rdfa:copy with resource', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +//
+ +//

+// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('rdfa:Pattern with one rdfa:copy with src', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +//
+ +//

+// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('unreferenced rdfa:copy', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://www.w3.org/ns/rdfa#copy', +// 'http://example.org/#muse'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('rdfa:Pattern with two rdfa:copy\'s', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +//
+ +//

+// +// United Center, Chicago, Illinois +//

+ +//

+// +// United Center, Chicago, Illinois 2 +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), + +// quad('_:b2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b2', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b2', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b2', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b2', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b2', +// 'http://schema.org/location', +// 'http://example.org/#united2'), +// ]); +// }); + +// it('rdfa:Pattern with blank node with two rdfa:copy\'s should only create a single blank node', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+//
+// Muse +//
+//
+ +//

+// +//

+ +//

+// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/refers-to', +// '_:b_shared'), +// quad('_:b_shared', +// 'http://schema.org/name', +// '"Muse"'), + +// quad('_:b2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b2', +// 'http://schema.org/refers-to', +// '_:b_shared'), +// ]); +// }); + +// it('rdfa:Pattern with two rdfa:copy\'s before the pattern definition', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

+// +// United Center, Chicago, Illinois +//

+ +//

+// +// United Center, Chicago, Illinois 2 +//

+ +//
+// +// +// +// Muse +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), + +// quad('_:b2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b2', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b2', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b2', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b2', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b2', +// 'http://schema.org/location', +// 'http://example.org/#united2'), +// ]); +// }); + +// it('rdfa:Pattern with two rdfa:copy\'s next to each other', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +//
+ +//

+// +// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('out-of-order rdfa:Pattern with one rdfa:copy', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

+// +// United Center, Chicago, Illinois +//

+ +//
+// +// +// +// Muse +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('in-order nested rdfa:Pattern and rdfa:copy', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// Muse +//
+//
+// +// +// +// +//
+ +//

+// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('mixed order nested rdfa:Pattern and rdfa:copy', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// +//
+//
+// Muse +//
+ +//

+// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('and ignore rdfa:copy to self-referencing rdfa:Pattern', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
+// +// +// +// Muse +// +//
+ +//

+// +// United Center, Chicago, Illinois +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/MusicEvent'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse1.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse2.jpg'), +// quad('_:b1', +// 'http://schema.org/image', +// 'http://example.org/Muse3.jpg'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Muse"'), +// quad('_:b1', +// 'http://schema.org/location', +// 'http://example.org/#united'), +// ]); +// }); + +// it('rdfa:copy via resource attribute', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+// +//
+//

Name: Amanda

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Person'), +// quad('_:b1', +// 'http://schema.org/name', +// '"Amanda"'), +// ]); +// }); + +// it('rdfa:copy and rdfa:Pattern are ignored when features.copyRdfaPatterns is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// +// +//
+// +//
+//

Name: Amanda

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://schema.org/Person'), +// quad('_:b1', +// 'http://www.w3.org/ns/rdfa#copy', +// '_:b2'), +// quad('_:b2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://www.w3.org/ns/rdfa#Pattern'), +// quad('_:b2', +// 'http://schema.org/name', +// '"Amanda"'), +// ]); +// }); + +// it('typeof with a single property', async () => { +// return expect(await parse(parser, ` +// +// Test 0051 +// +// +//

John Doe

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/topic', +// '"John Doe"'), +// ]); +// }); + +// it('typeof with a single property and resource', async () => { +// return expect(await parse(parser, ` +// +// Test 0051 +// +// +//

John Doe

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/res', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/topic', +// 'http://example.org/res'), +// ]); +// }); + +// it('typeof with a single property and compact resource', async () => { +// return expect(await parse(parser, ` +// +// Test 0051 +// +// +//

John Doe

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://xmlns.com/foaf/0.1/res', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/topic', +// 'http://xmlns.com/foaf/0.1/res'), +// ]); +// }); + +// it('typeof with a single property and href', async () => { +// return expect(await parse(parser, ` +// +// Test 0051 +// +// +//

John Doe

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/href', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/topic', +// 'http://example.org/href'), +// ]); +// }); + +// it('typeof with a single property and compact href', async () => { +// return expect(await parse(parser, ` +// +// Test 0051 +// +// +//

John Doe

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('foaf:href', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/topic', +// 'foaf:href'), +// ]); +// }); + +// it('typeof with a single property and src', async () => { +// return expect(await parse(parser, ` +// +// Test 0051 +// +// +//

John Doe

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/src', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/topic', +// 'http://example.org/src'), +// ]); +// }); + +// it('typeof with a single property and compact src', async () => { +// return expect(await parse(parser, ` +// +// Test 0051 +// +// +//

John Doe

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('foaf:src', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/topic', +// 'foaf:src'), +// ]); +// }); + +// it('typeof on root tag without property and about', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// ]); +// }); + +// it('typeof on root tag with property and without about', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// 'http://example.org/'), +// ]); +// }); + +// it('properties with inlist', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// Ben Adida, +// Mark Birbeck, and +// Ivan Herman. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://ben.adida.net/#me'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l2'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://twitter.com/markbirbeck'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l3'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://www.ivan-herman.net/foaf#me'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('properties with inlist and tag literals', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// Ben Adida, +// Mark Birbeck, and +// Ivan Herman. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://ben.adida.net/#me'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l2'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Mark Birbeck"'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l3'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://www.ivan-herman.net/foaf#me'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('properties with inlist and content literals', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// Ben Adida, +// BlaBla, and +// Ivan Herman. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://ben.adida.net/#me'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l2'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Mark Birbeck"'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l3'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://www.ivan-herman.net/foaf#me'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('properties with inlist and datetime literals', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// Ben Adida, +// , and +// Ivan Herman. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://ben.adida.net/#me'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l2'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"2018"^^http://www.w3.org/2001/XMLSchema#gYear'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l3'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://www.ivan-herman.net/foaf#me'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('properties and rel with inlist and mixed values', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// Ben Adida, +// Mark Birbeck, and +// Ivan Herman. +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://ben.adida.net/#me'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l2'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Mark Birbeck"'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l3'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://www.ivan-herman.net/foaf#me'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('inlist with incomplete triples', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// +// Ben Adida, +// Mark Birbeck, and +// Ivan Herman. +// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://ben.adida.net/#me'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l2'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://twitter.com/markbirbeck'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l3'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://www.ivan-herman.net/foaf#me'), +// quad('_:b_l3', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('an empty list', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('a manual empty list', async () => { +// return expect(await parse(parser, ` +// +// +// +//

+// +//

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://purl.org/ontology/bibo/Chapter'), +// quad('_:b1', +// 'http://purl.org/dc/terms/creator', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('@rel and @inlist with decendent IRI elements creates list', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//
    +//
  1. Foo
  2. +//
  3. Bar
  4. +//
+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://example.org/foo'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// '_:b_l2'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// 'http://example.org/bar'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('@about and @inlist creates a separate list', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Bar

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/res', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Bar"'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('@about and @inlist create a separate lists', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Bar

+//

Foo

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/res', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '_:b_l1'), +// quad('http://example.org/res', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '_:b_l2'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Bar"'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Foo"'), +// quad('_:b_l2', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('@property and @resource with child @inlist', async () => { +// return expect(await parse(parser, ` +// +// Test 0226 +// +// +// +//

Bar

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.example.org/inlist', +// 'http://example.org/res'), +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Bar"'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('@rel and @resource with child @inlist', async () => { +// return expect(await parse(parser, ` +// +// Test 0226 +// +// +// +//

Bar

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.example.org/inlist', +// 'http://example.org/res'), +// quad('http://example.org/res', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '_:b_l1'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', +// '"Bar"'), +// quad('_:b_l1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'), +// ]); +// }); + +// it('xmlns definition', async () => { +// return expect(await parse(parser, ` +// +// +// +// +//

This is the first chapter in a series of chapters.

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://example.org/next', +// 'http://rdfa.info/test-suite/test-cases/rdfa1.1/xhtml1/0062.xhtml'), +// ]); +// }); + +// it('xmlns definition when features.xmlnsPrefixMappings is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// +// +// +//

This is the first chapter in a series of chapters.

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'ex:next', +// 'http://rdfa.info/test-suite/test-cases/rdfa1.1/xhtml1/0062.xhtml'), +// ]); +// }); + +// it('@about that resolves to nothing', async () => { +// return expect(await parse(parser, ` +// +// +// +//
Alex Milowski
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// ]); +// }); + +// it('@about that resolves to nothing with @typeof', async () => { +// return expect(await parse(parser, ` +// +// +// +//
Alex Milowski
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// quad('_:b', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// ]); +// }); + +// it('@about that resolves to nothing in object', async () => { +// return expect(await parse(parser, ` +// +// Test 0298: Testing @typeof and @about=[] +// +// +//
+// Alex Milowski +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// ]); +// }); + +// it('@about that resolves to nothing with child rel', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Alex Milowski

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// ]); +// }); + +// it('@about that resolves to nothing with child tag', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Alex Milowski

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// ]); +// }); + +// it('@about that resolves to nothing with child tag with property', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Alex

Milowski
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/firstName', +// '"Alex"'), +// ]); +// }); + +// it('no @about with @typeof', async () => { +// return expect(await parse(parser, ` +// +// Test 0298: Testing @typeof and @about=[] +// +// +//
+// Alex Milowski +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// ]); +// }); + +// it('@about that resolves to nothing in object with @typeof', async () => { +// return expect(await parse(parser, ` +// +// Test 0298: Testing @typeof and @about=[] +// +// +//
+// Alex Milowski +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b1', +// 'http://xmlns.com/foaf/0.1/name', +// '"Alex Milowski"'), +// quad('_:b1', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// ]); +// }); + +// it('standalone @href', async () => { +// return expect(await parse(parser, ` +// +// +// +// Alex Milowski +// +// `)) +// .toBeRdfIsomorphic([]); +// }); + +// it('standalone @src', async () => { +// return expect(await parse(parser, ` +// +// +// +// +// +// `)) +// .toBeRdfIsomorphic([]); +// }); + +// it('@resource with nested [] property', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

+//

+// Shane McCarron +// contributed to this test. +//

+//

+//
+// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/contributor', +// '"Shane McCarron"'), +// ]); +// }); + +// it('@about and @resource with []', async () => { +// return expect(await parse(parser, ` +// +// +// +//
+//

+// Test Case 0121 +// checks to make sure RDFa processors resolve the empty CURIE correctly. +//

+// Shane McCarron +// contributed to this test. +//

+//

+//
+// `)) +// .toBeRdfIsomorphic([ +// quad('https://mydomain.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Test Case 0121"'), +// quad('http://example.org/', +// 'http://purl.org/dc/elements/1.1/contributor', +// '"Shane McCarron"'), +// ]); +// }); + +// it('@resource with nested [] property in XML mode', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', profile: 'xml' }); +// return expect(await parse(parser, ` +// +// +// +//
+//

+//

+// Shane McCarron +// contributed to this test. +//

+//

+//
+// `)) +// .toBeRdfIsomorphic([ +// quad('https://mydomain.org/', +// 'http://purl.org/dc/elements/1.1/contributor', +// '"Shane McCarron"'), +// ]); +// }); + +// it('@about and @resource with [] in XML mode', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', profile: 'xml' }); +// return expect(await parse(parser, ` +// +// +// +//
+//

+// Test Case 0121 +// checks to make sure RDFa processors resolve the empty CURIE correctly. +//

+// Shane McCarron +// contributed to this test. +//

+//

+//
+// `)) +// .toBeRdfIsomorphic([ +// quad('https://mydomain.org/', +// 'http://purl.org/dc/elements/1.1/title', +// '"Test Case 0121"'), +// quad('https://mydomain.org/', +// 'http://purl.org/dc/elements/1.1/contributor', +// '"Shane McCarron"'), +// ]); +// }); + +// it('@resource with [] is not allowed and resolved to nothing', async () => { +// return expect(await parse(parser, ` +// +// +// +// +//

+// This section is contained below the main site. +//

+// +// `)) +// .toBeRdfIsomorphic([]); +// }); + +// it('@typeof in , and inherit parent object', async () => { +// const data = ` +// +// Test 0066 +// +// +//

This is test #66.

+// +// ` + +// // In tests the parser object can only appear once +// // expect(await parse(parser, data)) +// // .toBeRdfIsomorphic([ +// // quad('http://example.org/', +// // 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// // 'http://xmlns.com/foaf/0.1/Document'), +// // ]); + +// expect(await collectPrefixes(parser, data)) +// .toEqual({}); +// }); + +// it('@typeof in , and inherit parent object', async () => { +// return expect(await parse(parser, ` +// +// Test 0066 +// +// +//

This is test #66.

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// ]); +// }); + +// it('@typeof and @property in , and inherit parent object', async () => { +// return expect(await parse(parser, ` +// +// Test 0066 +// +// +//

This is test #66.

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// 'http://example.org/'), +// ]); +// }); + +// it('@typeof and @property in , and not inherit parent object ' + +// 'if features.inheritSubjectInHeadBody is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// Test 0066 +// +// +//

This is test #66.

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '_:b'), +// quad('_:b', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// ]); +// }); + +// it('@typeof and @rel in ', async () => { +// return expect(await parse(parser, ` +// +// Test 0066 +// +// +//

This is test #66.

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// ]); +// }); + +// it('@typeof and @rel in when features.inheritSubjectInHeadBody is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// Test 0066 +// +// +//

This is test #66.

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Document'), +// quad('http://example.org/', +// 'http://xmlns.com/foaf/0.1/name', +// '_:b'), +// ]); +// }); + +// it('should ignore invalid datatypes', async () => { +// return expect(await parse(parser, ` +// +// +// +// +//

JavaScript

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/me', +// 'http://purl.org/dc/terms/language', +// '"JavaScript"'), +// ]); +// }); + +// it('@property with no children should make empty literal', async () => { +// return expect(await parse(parser, ` +// +// Test 0257 +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#a', +// 'http://purl.org/dc/elements/1.1/title', +// '""'), +// ]); +// }); + +// it('@about and empty @datatype should force string literal value', async () => { +// return expect(await parse(parser, ` +// +// Test 0290 +// +// +//

@href becomes subject when @property and @datatype are present

+//

value

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '"value"'), +// ]); +// }); + +// it('@about and empty @datatype should force string literal value even with xmlns', async () => { +// return expect(await parse(parser, ` +// +// Test 0290 +// +// +//

@href becomes subject when @property and @datatype are present

+//

value

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '"value"'), +// ]); +// }); + +// it('@href and empty @datatype should force string literal value', async () => { +// return expect(await parse(parser, ` +// +// Test 0290 +// +// +//

@href becomes subject when @property and @datatype are present

+// value +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', +// '"value"'), +// ]); +// }); + +// it('@property does not set parent object without @typeof', async () => { +// return expect(await parse(parser, ` +// +// Test 0296 +// +// +//
+// Gregg +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://xmlns.com/foaf/0.1/'), +// quad('http://example.com/gregg/#me', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// quad('http://example.com/gregg/#me', +// 'http://xmlns.com/foaf/0.1/homepage', +// 'http://example.com/gregg/'), +// quad('http://example.com/gregg/#me', +// 'http://xmlns.com/foaf/0.1/name', +// '"Gregg"'), +// ]); +// }); + +// it('@property does set parent object with @typeof', async () => { +// return expect(await parse(parser, ` +// +// Test 0296 +// +// +//
+// Gregg +//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://xmlns.com/foaf/0.1/'), +// quad('http://example.com/gregg/', +// 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', +// 'http://xmlns.com/foaf/0.1/Person'), +// quad('http://example.com/gregg/#me', +// 'http://xmlns.com/foaf/0.1/homepage', +// 'http://example.com/gregg/'), +// quad('http://example.com/gregg/', +// 'http://xmlns.com/foaf/0.1/name', +// '"Gregg"'), +// ]); +// }); + +// it('@resource that resolves to nothing should fallback to @href or @src', async () => { +// return expect(await parse(parser, ` +// +// Test 0300: Testing @resource=[] +// +// +// The Foo Document +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://www.example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#license', +// 'http://www.example.org/license.xhtml'), +// ]); +// }); + +// it('@rel should not do vocab expansion when another valid value is present', async () => { +// return expect(await parse(parser, ` +// +// Test 0334: @resource changes the current subject for the nested elements +// +// +//
+//
+//

Gregg Kellogg

+//
+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/ns/rdfa#usesVocabulary', +// 'http://schema.org/'), +// quad('http://greggkellogg.net/#me', +// 'http://schema.org/name', +// '"Gregg Kellogg"'), +// quad('http://greggkellogg.net/#me', +// 'http://xmlns.com/foaf/0.1/homepage', +// 'http://greggkellogg.net/'), +// ]); +// }); + +// it('xml:base to set the baseIRI within the current scope', async () => { +// return expect(await parse(parser, ` +// +// version="1.2" +// baseProfile="tiny" +// A yellow rectangle with sharp corners. +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.com/', +// 'http://purl.org/dc/terms/description', +// '"A yellow rectangle with sharp corners."'), +// ]); +// }); + +// it('xml:base shoud not set the baseIRI outside the current scope', async () => { +// return expect(await parse(parser, ` +// +// version="1.2" +// baseProfile="tiny" +//

abc

+// A yellow rectangle with sharp corners. +// +// +// +//
`)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/terms/description', +// '"A yellow rectangle with sharp corners."'), +// ]); +// }); + +// it('xml:base not to set the baseIRI when features.xmlBase is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// version="1.2" +// baseProfile="tiny" +// A yellow rectangle with sharp corners. +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://purl.org/dc/terms/description', +// '"A yellow rectangle with sharp corners."'), +// ]); +// }); + +// it('should be able to ignore base tag and resolve relative IRIs against baseIRI', async () => { +// const features = { baseTag: false, xmlBase: true, xmlnsPrefixMappings: true }; +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features }); +// return expect(await parse(parser, ` +// +// +// +// Test 0319 +// +// +//

value

+// +//
`)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://example.org/relative/iri#prop', +// '"value"'), +// quad('http://example.org/', +// 'http://example.org/relative/uri#prop', +// '"value"'), +// ]); +// }); + +// it('should be able to ignore base tag and resolve relative IRIs against baseIRI in HTML-mode', async () => { +// return expect(await parse(parser, ` +// +// +// +// Test 0319 +// +// +//

value

+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.com/', +// 'http://example.org/relative/iri#prop', +// '"value"'), +// quad('http://example.com/', +// 'http://example.org/relative/uri#prop', +// '"value"'), +// ]); +// }); + +// it('should handle whitespace alternatives', async () => { +// return expect(await parse(parser, ` +// +// Test +// +// +// +// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#first', +// 'http://example.org/test.css'), +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#last', +// 'http://example.org/test.css'), +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#next', +// 'http://example.org/test.css'), +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#prev', +// 'http://example.org/test.css'), +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#subsection', +// 'http://example.org/test.css'), +// ]); +// }); + +// it('should handle terms from the XHTML initial context', async () => { +// return expect(await parse(parser, ` +// +// Test 0259 +// +// +//
+// Vocabulary Terms +// alternate +// appendix +// cite +//
+// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#alternate', +// '"alternate"'), +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#appendix', +// '"appendix"'), +// quad('http://example.org/', +// 'http://www.w3.org/1999/xhtml/vocab#cite', +// '"cite"'), +// ]); +// }); + +// it('should handle terms from the XHTML initial context ' + +// 'unless features.xhtmlInitialContext is disabled', async () => { +// parser = new RdfaParser({ baseIRI: 'http://example.org/', features: {} }); +// return expect(await parse(parser, ` +// +// Test 0259 +// +// +//
+// Vocabulary Terms +// alternate +// appendix +// cite +//
+// `)) +// .toBeRdfIsomorphic([]); +// }); + +// it('property with blank node values should be ignored', async () => { +// return expect(await parse(parser, ` +// +// +// +//

Value ignored

+// +// `)) +// .toBeRdfIsomorphic([]); +// }); + +// it('role attribute with id', async () => { +// return expect(await parse(parser, ` +// +// Test 0305 +// +// +//
+//

Some contents that are a header

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#heading1', +// 'http://www.w3.org/1999/xhtml/vocab#role', +// 'http://www.w3.org/1999/xhtml/vocab#heading'), +// ]); +// }); + +// it('role attribute without id', async () => { +// return expect(await parse(parser, ` +// +// Test 0305 +// +// +//
+//

Some contents that are a header

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('_:b', +// 'http://www.w3.org/1999/xhtml/vocab#role', +// 'http://www.w3.org/1999/xhtml/vocab#heading'), +// ]); +// }); + +// it('role attribute with multiple values', async () => { +// return expect(await parse(parser, ` +// +// Test 0305 +// +// +//
+//

Some contents that are a header

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#heading1', +// 'http://www.w3.org/1999/xhtml/vocab#role', +// 'http://www.w3.org/1999/xhtml/vocab#heading1'), +// quad('http://example.org/#heading1', +// 'http://www.w3.org/1999/xhtml/vocab#role', +// 'http://www.w3.org/1999/xhtml/vocab#heading2'), +// ]); +// }); + +// it('role attribute with absolute IRI', async () => { +// return expect(await parse(parser, ` +// +// Test 0305 +// +// +//
+//

Some contents that are a header

+//
+// +// `)) +// .toBeRdfIsomorphic([ +// quad('http://example.org/#heading1', +// 'http://www.w3.org/1999/xhtml/vocab#role', +// 'http://ex.org/heading'), +// ]); +// }); }); @@ -4198,3 +4219,27 @@ prefix="xhv: http://www.w3.org/1999/xhtml/vocab#"> function parse(parser: RdfaParser, input: string): Promise { return arrayifyStream(streamifyString(input).pipe(parser)); } + +async function collectPrefixes(parser: RdfaParser, input: string): Promise> { + console.log(1) + const prefixes: Record = {}; + console.log(2) + + const stream = streamifyString(input).pipe(parser); + console.log(3) + + // Wait a moment to make sure we aren't prematurely + // emitting prefixes + // await new Promise(res => { setTimeout(res, 2) }); + + stream.on('prefix', (prefix: string, suffix: RDF.NamedNode) => { + console.log('prefix called in collect prefies') + prefixes[prefix] = suffix + }); + + return new Promise((res, rej) => { + stream.on('error', rej); + stream.on('end', () => res(prefixes)); + stream.on('data', () => {}) + }) +}