Search in sources :

Example 1 with PrefixMappingImpl

use of org.apache.jena.shared.impl.PrefixMappingImpl in project jena by apache.

the class TestSSE_Forms method beforeClass.

@BeforeClass
public static void beforeClass() {
    original = SSE.getPrefixMapRead();
    PrefixMapping pmaptest = new PrefixMappingImpl().setNsPrefixes(original).removeNsPrefix("").removeNsPrefix("ex");
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) PrefixMappingImpl(org.apache.jena.shared.impl.PrefixMappingImpl) BeforeClass(org.junit.BeforeClass)

Example 2 with PrefixMappingImpl

use of org.apache.jena.shared.impl.PrefixMappingImpl in project webofneeds by researchstudio-sat.

the class WonLinkedDataUtils method getConnectionNetwork.

public static Dataset getConnectionNetwork(URI atomURI, URI webId, LinkedDataSource linkedDataSource) {
    assert linkedDataSource != null : "linkedDataSource must not be null";
    int depth = 5;
    int maxRequests = 1000;
    List<Path> propertyPaths = new ArrayList<>();
    PrefixMapping pmap = new PrefixMappingImpl();
    pmap.withDefaultMappings(PrefixMapping.Standard);
    pmap.setNsPrefix("won", WON.getURI());
    pmap.setNsPrefix("msg", WONMSG.getURI());
    propertyPaths.add(PathParser.parse("won:connections", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member", pmap));
    return linkedDataSource.getDataForResourceWithPropertyPath(atomURI, webId, propertyPaths, maxRequests, depth);
}
Also used : Path(org.apache.jena.sparql.path.Path) PrefixMapping(org.apache.jena.shared.PrefixMapping) PrefixMappingImpl(org.apache.jena.shared.impl.PrefixMappingImpl)

Example 3 with PrefixMappingImpl

use of org.apache.jena.shared.impl.PrefixMappingImpl in project webofneeds by researchstudio-sat.

the class WonLinkedDataUtils method getFullAtomDataset.

public static Dataset getFullAtomDataset(URI atomURI, LinkedDataSource linkedDataSource) {
    assert linkedDataSource != null : "linkedDataSource must not be null";
    int depth = 7;
    int maxRequests = 1000;
    List<Path> propertyPaths = new ArrayList<>();
    PrefixMapping pmap = new PrefixMappingImpl();
    pmap.withDefaultMappings(PrefixMapping.Standard);
    pmap.setNsPrefix("won", WON.getURI());
    pmap.setNsPrefix("msg", WONMSG.getURI());
    propertyPaths.add(PathParser.parse("won:connections", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer/rdfs:member", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer/rdfs:member/msg:correspondingRemoteMessage", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer/rdfs:member/msg:previousMessage", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom/won:messageContainer", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom/won:messageContainer/rdfs:member", pmap));
    propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom/won:messageContainer/rdfs:member/msg:previousMessage", pmap));
    return linkedDataSource.getDataForResourceWithPropertyPath(atomURI, atomURI, propertyPaths, maxRequests, depth);
}
Also used : Path(org.apache.jena.sparql.path.Path) PrefixMapping(org.apache.jena.shared.PrefixMapping) PrefixMappingImpl(org.apache.jena.shared.impl.PrefixMappingImpl)

Example 4 with PrefixMappingImpl

use of org.apache.jena.shared.impl.PrefixMappingImpl in project webofneeds by researchstudio-sat.

the class WonLinkedDataUtils method getConversationDataset.

public static Dataset getConversationDataset(URI connectionURI, URI requesterWebId, LinkedDataSource linkedDataSource) {
    assert linkedDataSource != null : "linkedDataSource must not be null";
    // depth 3 from connection gives us the messages in the conversation
    int depth = 5;
    int maxRequests = 1000;
    List<Path> propertyPaths = new ArrayList<>();
    PrefixMapping pmap = new PrefixMappingImpl();
    pmap.withDefaultMappings(PrefixMapping.Standard);
    pmap.setNsPrefix("won", WON.getURI());
    pmap.setNsPrefix("msg", WONMSG.getURI());
    propertyPaths.add(PathParser.parse("won:messageContainer", pmap));
    propertyPaths.add(PathParser.parse("won:messageContainer/rdfs:member", pmap));
    propertyPaths.add(PathParser.parse("won:targetConnection", pmap));
    propertyPaths.add(PathParser.parse("won:targetConnection/won:messageContainer", pmap));
    propertyPaths.add(PathParser.parse("won:targetConnection/won:messageContainer/rdfs:member", pmap));
    return linkedDataSource.getDataForResourceWithPropertyPath(connectionURI, requesterWebId, propertyPaths, maxRequests, depth);
}
Also used : Path(org.apache.jena.sparql.path.Path) PrefixMapping(org.apache.jena.shared.PrefixMapping) PrefixMappingImpl(org.apache.jena.shared.impl.PrefixMappingImpl)

Example 5 with PrefixMappingImpl

use of org.apache.jena.shared.impl.PrefixMappingImpl in project webofneeds by researchstudio-sat.

the class WonLinkedDataUtils method getConversationAndAtomsDataset.

public static Dataset getConversationAndAtomsDataset(URI connectionURI, URI requesterWebId, LinkedDataSource linkedDataSource) {
    Objects.requireNonNull(linkedDataSource);
    Objects.requireNonNull(connectionURI);
    int depth = 5;
    int maxRequests = 1000;
    List<Path> propertyPaths = new ArrayList<>();
    PrefixMapping pmap = new PrefixMappingImpl();
    pmap.withDefaultMappings(PrefixMapping.Standard);
    pmap.setNsPrefix("won", WON.getURI());
    pmap.setNsPrefix("msg", WONMSG.getURI());
    propertyPaths.add(PathParser.parse("won:messageContainer", pmap));
    propertyPaths.add(PathParser.parse("won:messageContainer/rdfs:member", pmap));
    propertyPaths.add(PathParser.parse("won:messageContainer/rdfs:member/msg:previousMessage", pmap));
    return linkedDataSource.getDataForResourceWithPropertyPath(connectionURI, requesterWebId, propertyPaths, maxRequests, depth);
}
Also used : Path(org.apache.jena.sparql.path.Path) PrefixMapping(org.apache.jena.shared.PrefixMapping) PrefixMappingImpl(org.apache.jena.shared.impl.PrefixMappingImpl)

Aggregations

PrefixMappingImpl (org.apache.jena.shared.impl.PrefixMappingImpl)39 PrefixMapping (org.apache.jena.shared.PrefixMapping)34 Test (org.junit.Test)13 Path (org.apache.jena.sparql.path.Path)11 Graph (org.apache.jena.graph.Graph)8 WhereValidator (org.apache.jena.arq.querybuilder.WhereValidator)4 TriplePath (org.apache.jena.sparql.core.TriplePath)4 ElementPathBlock (org.apache.jena.sparql.syntax.ElementPathBlock)4 BeforeClass (org.junit.BeforeClass)4 ElementOptional (org.apache.jena.sparql.syntax.ElementOptional)3 ContractTest (org.xenei.junit.contract.ContractTest)3 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 Triple (org.apache.jena.graph.Triple)2 Dataset (org.apache.jena.query.Dataset)2 Date (java.util.Date)1 Trie (org.apache.jena.atlas.lib.Trie)1 SecuredPrefixMapping (org.apache.jena.permissions.graph.SecuredPrefixMapping)1 Query (org.apache.jena.query.Query)1 UpdateDeniedException (org.apache.jena.shared.UpdateDeniedException)1